Skip to content

feat(cli): add config command to read and set preferences#215

Merged
jongio merged 1 commit into
mainfrom
idea/config-cli-command
Jul 6, 2026
Merged

feat(cli): add config command to read and set preferences#215
jongio merged 1 commit into
mainfrom
idea/config-cli-command

Conversation

@jongio

@jongio jongio commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a headless dispatch config command so preferences can be read and changed from scripts, dotfiles, and setup steps without opening the TUI settings panel or hand-editing config.json. This rounds out the existing family of headless commands (open, stats, doctor, completion).

Subcommands:

  • dispatch config list prints every setting and its value. Add --json for a single JSON object, matching doctor --json and stats --json.
  • dispatch config get <key> prints one value.
  • dispatch config set <key> <value> validates the value and writes it through the existing config.Load/config.Save path, so validation and migrations still run.
  • dispatch config path prints the resolved config file path.

Unknown keys and invalid values return a clear error and a non-zero exit code.

Changes

  • cmd/dispatch/config.go: new command. Settings are exposed through an explicit field registry (name, kind, get, set) covering the scalar preferences. Enum, integer, and duration values are validated on set. auto_refresh_seconds is a pointer, so set auto_refresh_seconds default clears it back to unset.
  • cmd/dispatch/cli.go: wired the config subcommand into handleArgs and added it (plus its subcommands) to the bash, zsh, and PowerShell completion scripts.
  • cmd/dispatch/main.go: documented the command in printUsage.
  • cmd/dispatch/config_test.go: table of tests for list/get/set/path, JSON output, validation errors, the pointer field, save failures, handleArgs wiring, and a round-trip check that every get value is accepted by its own set.
  • README.md: documented the command under Configuration.

Testing

  • go build ./...
  • go vet ./...
  • golangci-lint run ./... (0 issues)
  • go test ./... -count=1 (all packages pass)

Closes #212

@jongio jongio added the idea Feature idea from the idea pipeline label Jul 3, 2026
@jongio jongio self-assigned this Jul 3, 2026
Add a headless 'dispatch config' command with list, get, set, and path
subcommands so preferences can be read and changed without opening the
TUI or hand-editing config.json. Set validates the value and persists
through the existing config save path. Wired into handleArgs and the
bash, zsh, and PowerShell completion scripts.

Closes #212

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio force-pushed the idea/config-cli-command branch from 26ae84e to 86b8796 Compare July 6, 2026 07:53
@jongio jongio merged commit 63b6973 into main Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a config command to read and set preferences from the CLI

1 participant