Skip to content

Keep command-line options out of saved settings; sort by any column - #148

Draft
faratech wants to merge 1 commit into
mainfrom
claude/project-thread-ih38we
Draft

faratech wants to merge 1 commit into
mainfrom
claude/project-thread-ih38we

Conversation

@faratech

Copy link
Copy Markdown
Owner

Requested by Mike · project thread

Problem

apply_config_overrides writes command-line options straight into the live Config, and every save path (closing Setup, toggling or moving a column, picking a theme or GPU) writes the whole config to config.json. So one run of:

  • htop --no-color → every later session is Monochrome
  • htop -d 100 → refresh rate stays 100 ms
  • htop -t / -H 5 / --no-auto-update → tree default, highlight, and auto-update are changed for good
  • htop -s pid → the Main tab's saved sort is replaced

…as soon as the user opens and closes Setup. --readonly was already made runtime-only for the same reason; the other options were not.

Fix

  • config::CliOverrides remembers the config as loaded and as launched. On save, any setting that still holds its command-line value is written with the file's value; a setting the user changed in-app is saved normally (and the baseline updates after each successful write). The -s sort is tracked per tab the same way.
  • Reset All Settings drops the overrides, so defaults are saved.
  • The --benchmark 10 ms refresh rate moves into apply_config_overrides, so it goes through the same path.

-s / --sort

The README advertises 27 sortable columns but -s accepted 8. It now accepts every column header case-insensitively (io_rate, gpu%, time+, npu-mem, …) plus the old aliases (cpu, mem/memory, time, cmd, threads). An unknown name now fails during argument parsing, before the terminal enters the alternate screen. Sorting by the column the tab already uses keeps its direction; a different column sorts descending, as when it's picked in-app.

Testing

  • cargo clippy --all-targets --target x86_64-pc-windows-gnu -- -D warnings: clean.
  • New tests: cli_overrides_are_not_saved_until_changed_in_app, cli_sort_is_not_saved_until_changed_in_app, cli_sort_applies_to_the_active_tab_without_being_saved, reset_settings_drops_cli_overrides, sort_accepts_every_column_header_and_aliases, benchmark_refresh_rate_yields_to_an_explicit_delay.
  • I ran these and the app/config/input/ui unit tests (197), plus retained_render, visual_test, installed_version and installer_serialization, under Wine on Linux; all passed. Tests that need real process enumeration, D3DKMT or console handles can't run under Wine, so Windows CI is the full gate.

Generated by Claude Code

Options such as -d, -t, --no-color, -H, --no-auto-update and -s changed the
live config, and the next save (closing Setup, changing a column, picking a
theme) wrote them to config.json. One `htop --no-color` run could leave
every later session monochrome. Saving now writes the file's value for any
setting that still holds its command-line value; a setting changed in-app
is saved as before. Reset All Settings drops the overrides. The benchmark
refresh rate moves into the same override path.

-s now accepts every column header (case-insensitive, e.g. io_rate, gpu%,
time+) plus the old aliases, and an unknown name fails during argument
parsing instead of after the terminal switches to the alternate screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FGrdiiacNPhARasAaxgfPa
@faratech faratech self-assigned this Oct 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants