feat(cli): add config command to read and set preferences#215
Merged
Conversation
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>
26ae84e to
86b8796
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a headless
dispatch configcommand so preferences can be read and changed from scripts, dotfiles, and setup steps without opening the TUI settings panel or hand-editingconfig.json. This rounds out the existing family of headless commands (open,stats,doctor,completion).Subcommands:
dispatch config listprints every setting and its value. Add--jsonfor a single JSON object, matchingdoctor --jsonandstats --json.dispatch config get <key>prints one value.dispatch config set <key> <value>validates the value and writes it through the existingconfig.Load/config.Savepath, so validation and migrations still run.dispatch config pathprints 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_secondsis a pointer, soset auto_refresh_seconds defaultclears it back to unset.cmd/dispatch/cli.go: wired theconfigsubcommand intohandleArgsand added it (plus its subcommands) to the bash, zsh, and PowerShell completion scripts.cmd/dispatch/main.go: documented the command inprintUsage.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 everygetvalue is accepted by its ownset.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