fix: clean up update TUI output and suppress noisy stderr

- Add dedicated render branch for self_update results.
- Hide progress-only stderr on success to eliminate pipx noise.
- Remove generic "RESULT" heading from fallback key-value output.
- Bump version to 2.0.3.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 18:47:08 +08:00
parent 9395978440
commit cdc90a9be1
2 changed files with 24 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "coinhunter"
version = "2.0.2"
version = "2.0.3"
description = "Binance-first trading CLI for balances, market data, opportunity scanning, and execution."
readme = "README.md"
license = {text = "MIT"}

View File

@@ -328,6 +328,23 @@ def _render_tui(payload: Any) -> None:
print(f" {_DIM}{metric_str}{_RESET}")
return
if "command" in payload and "returncode" in payload:
rc = payload.get("returncode", 0)
stdout = payload.get("stdout", "")
stderr = payload.get("stderr", "")
if rc == 0:
print(f"\n{_GREEN}{_RESET} Update completed")
else:
print(f"\n{_RED}{_RESET} Update failed (exit code {rc})")
if stdout:
for line in stdout.strip().splitlines():
print(f" {line}")
if rc != 0 and stderr:
print(f" {_YELLOW}Details:{_RESET}")
for line in stderr.strip().splitlines():
print(f" {line}")
return
# Generic fallback for single-list payloads
if len(payload) == 1:
key, value = next(iter(payload.items()))
@@ -336,9 +353,13 @@ def _render_tui(payload: Any) -> None:
return
# Simple key-value fallback
print(f"\n{_BOLD}{_CYAN} RESULT {_RESET}")
for key, value in payload.items():
print(f" {key}: {value}")
if isinstance(value, str) and "\n" in value:
print(f" {key}:")
for line in value.strip().splitlines():
print(f" {line}")
else:
print(f" {key}: {value}")
def print_output(payload: Any, *, agent: bool = False) -> None: