Move init to 'config init', add config edit/get/set subcommands

The config command group manages the config file:
  config init  - write default config (moved from top-level init)
  config edit  - open the config in $EDITOR (falls back to vi)
  config get   - print a value by dotted YAML path (s3.bucket)
  config set   - set a scalar value by dotted YAML path

get/set operate on the yaml.Node tree so comments and formatting in
the config file are preserved across edits. set creates intermediate
maps as needed.
This commit is contained in:
2026-06-10 11:23:47 -07:00
parent 307867f59e
commit b2e160944f
6 changed files with 402 additions and 54 deletions

View File

@@ -41,7 +41,7 @@ on the source system.`,
// Add subcommands
cmd.AddCommand(
NewInitCommand(),
NewConfigCommand(),
NewRestoreCommand(),
NewPruneCommand(),
NewStoreCommand(),
@@ -78,7 +78,7 @@ func ResolveConfigPath() (string, error) {
}
}
return "", fmt.Errorf("no config file found; run 'vaultik init' to create one, or specify with --config")
return "", fmt.Errorf("no config file found; run 'vaultik config init' to create one, or specify with --config")
}
// defaultConfigPaths returns the ordered list of config paths to search.