From 60bbf210dffba7b2a5c6068c4ca535d8a50f4e24 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 09:58:10 +0000 Subject: [PATCH] feat(ux): improve loading bar terminal output - Use carriage returns for in-place loading bar updates in `simulasyon_11.py`. - Add learning about CLI progress output to `.Jules/palette.md`. Co-authored-by: Soldiers33 <255096253+Soldiers33@users.noreply.github.com> --- .Jules/palette.md | 3 +++ simulasyon_11.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .Jules/palette.md diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 00000000..7f0d2114 --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2025-03-02 - [CLI Progress Updates] +**Learning:** Terminal output can become cluttered when iterating through multiple loading steps, reducing the clarity of the overall output stream. Using a simple carriage return (`\r`) with `flush=True` creates clean, in-place progress bars that update the same line instead of spamming standard out. +**Action:** When printing loading bars or single-line progress sequences in command-line tools, default to `\r` and ensure the output stream is flushed. \ No newline at end of file diff --git a/simulasyon_11.py b/simulasyon_11.py index 4e07b8b1..ae9bf00a 100644 --- a/simulasyon_11.py +++ b/simulasyon_11.py @@ -35,9 +35,9 @@ class Colors: # ============================================================================== def loading_bar(desc): - print(f"{Colors.CYAN}{desc}...{Colors.ENDC}") + print(f"\r{Colors.CYAN}{desc}...{Colors.ENDC}", end='', flush=True) time.sleep(0.01) - print(f"{Colors.GREEN}[OK]{Colors.ENDC}") + print(f"\r{Colors.CYAN}{desc}... {Colors.GREEN}[OK]{Colors.ENDC}") # ------------------------------------------------------------------------------