Skip to content

Commit 42840bd

Browse files
authored
Update progress.hcs
1 parent 5e71d6e commit 42840bd

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

virus/cmd/progress.hcs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
1+
get <std:term> import <c_bold_green::c_bold_red::c_red::c_yellow::c_cyan::c_gray::print_progress_line>
2+
3+
!!! ROZBUDOWANE w tej rundzie (patrz docs/ROADMAP.md) - poprzednia
4+
!!! wersja tego pliku byla plaskim `log("[i/n]", tekst)` bez kolorow.
5+
!!! Teraz `progress_header`/`progress_success`/... sa kolorowane przez
6+
!!! `std:term` (wylaczane automatycznie przez `NO_COLOR`), a
7+
!!! `progress_step` renderuje PRAWDZIWY, wypelniany procentowo pasek
8+
!!! (patrz `render_bar`/`print_progress_line` w libs/std/lib/term.hcs)
9+
!!! zamiast samego licznika tekstowego.
10+
111
fun progress_header(text: Str) [
2-
log("==>", text)
12+
log(c_bold_green("==>") + " " + text)
313
]
414

515
fun progress_info(text: Str) [
6-
log("info:", text)
16+
log(c_cyan("info:") + " " + text)
717
]
818

919
fun progress_warn(text: Str) [
10-
log("uwaga:", text)
20+
log(c_yellow("uwaga:") + " " + text)
1121
]
1222

1323
!!! Na stderr (parytet z `eprintln!` w oryginalnym Rust).
1424
fun progress_error(text: Str) [
15-
elog("blad:", text)
25+
elog(c_red("blad:") + " " + text)
1626
]
1727

1828
fun progress_success(text: Str) [
19-
log("ok:", text)
29+
log(c_bold_green("ok:") + " " + text)
2030
]
2131

22-
!!! Prosty licznik krokow "[obecny/razem] wiadomosc" - zastepuje pasek
23-
!!! postepu `indicatif` (patrz uwaga na gorze pliku). `total <= 0`
24-
!!! pomija licznik i drukuje sama wiadomosc.
32+
!!! Realny, kolorowy pasek postepu "[####----] NN% (i/total) wiadomosc"
33+
!!! - kazde wywolanie z tym samym total > 1 NADPISUJE poprzednia linie
34+
!!! w miejscu (patrz print_progress_line), wiec petla po plikach
35+
!!! wyglada jak JEDEN animowany pasek, nie seria osobnych linii.
36+
!!! total <= 0 pomija pasek i drukuje sama wiadomosc (parytet ze starym
37+
!!! zachowaniem - uzywane tam, gdzie liczba krokow nie jest z gory znana).
2538
fun progress_step(current: Int, total: Int, message: Str) [
2639
if total > 0 [
27-
log("[" + (current as Str) + "/" + (total as Str) + "]", message)
40+
print_progress_line("", current, total, message, current <= 1)
2841
] else [
2942
log(message)
3043
]

0 commit comments

Comments
 (0)