feat: add --json flag, diff, export/import, watch#2
Merged
lu-zhengda merged 1 commit intomainfrom Feb 15, 2026
Merged
Conversation
- Add global --json flag for machine-readable output on all subcommands - Add json struct tags to all exported types (SearchResult, Setting, Category, Config, backup Entry/Backup, preset types) - Add JSON output branch to list, get, search, preset, and backup commands - New diff subcommand: compare current state against a backup snapshot - New export subcommand: export managed defaults to portable JSON - New import subcommand: import and apply defaults from export file - New watch subcommand: monitor a key for changes with configurable interval - Add completions/ to .gitignore - Add tests for parsing and output functions
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
--jsonpersistent flag for machine-readable output on all subcommands (list, get, search, preset, backup)json:"snake_case"struct tags to all exported types across internal packagesdiff <backup-file>subcommand to compare current defaults state against a backup snapshotexport [file]subcommand to export managed defaults to a portable JSON file for cross-machine sharingimport <file>subcommand to import and apply defaults from an export filewatch <domain> <key>subcommand to monitor a defaults key for changes with configurable--intervalcompletions/to.gitignoreTest plan
go build ./...passesgo vet ./...passesgo test -race ./...passes (new tests for parseImportValue, parseBoolImport, printJSON)macfig list --jsonoutputs valid JSONmacfig get <domain> <key> --jsonoutputs structured resultmacfig search <query> --jsonoutputs structured resultsmacfig backup --jsonoutputs backup info as JSONmacfig diff <backup-file>shows changesmacfig exportcreates portable JSON filemacfig import <file>applies settings from exportmacfig watch <domain> <key>polls and reports changes🤖 Generated with Claude Code