Let a flag turn a boolean setting back on

Both booleans could only be switched one way from the command line. There
was a --no-outputs but no --outputs in the help, and no --labels at all, so
a config file saying `outputs = no` could not be overridden for a single
run: the only way back was to edit the file. "A flag always beats the file"
was true of everything that takes a value and half true of the rest.

So --outputs and --labels are the counterparts, --no-labels is the negative
that matches them, and --hide-labels stays accepted for whatever it is
already wired into. --outputs turned out to be parsed already and merely
undocumented, which is its own kind of missing.

Argument parsing moves behind parse(), taking the arguments as an iterator
rather than reading the environment, so precedence is testable. The tests
pin both directions and the fall-through to file then default, which is the
part that quietly went wrong.
This commit is contained in:
Milad Alizadeh
2026-09-07 18:25:47 +01:00
parent a99de502e2
commit 6bd4a3ee76
2 changed files with 75 additions and 7 deletions
+6 -3
View File
@@ -36,7 +36,8 @@ is the one thing the rofi version had that this doesn't — see the roadmap.
```
wl-pick [--format tsv|json|portal] [--live all|current|none] [--fps N]
[--no-outputs] [--hide-labels] [--font FAMILY] [--font-size PX]
[--outputs|--no-outputs] [--labels|--no-labels]
[--font FAMILY] [--font-size PX]
[--timeout SECS] [--verbose]
```
@@ -44,8 +45,10 @@ wl-pick [--format tsv|json|portal] [--live all|current|none] [--fps N]
- `--live all|current|none` which tiles keep updating (default `all`; displays
are always a single snapshot)
- `--fps N` cap on live updates per tile per second (default 12)
- `--no-outputs` windows only; displays are included as tiles by default
- `--hide-labels` draws an icon-only grid
- `--outputs` / `--no-outputs` whether whole displays are tiles too (default
on). Both directions exist so either can override the config file
- `--labels` / `--no-labels` whether a label is drawn under each thumbnail
(default on); `--hide-labels` is the old spelling and still works
- `--font FAMILY` label font family (default: the system monospace font)
- `--font-size PX` label size in logical px
- `--config PATH` config file (default `~/.config/wl-pick/config`)