(deps commandDeps)
| 402 | } |
| 403 | |
| 404 | func newConfigGetCommand(deps commandDeps) *cobra.Command { |
| 405 | var workspaceRoot string |
| 406 | cmd := &cobra.Command{ |
| 407 | Use: "get <path>", |
| 408 | Short: "Get one redacted effective config value", |
| 409 | Args: exactOneNonBlankArg(), |
| 410 | RunE: func(cmd *cobra.Command, args []string) error { |
| 411 | cfg, _, err := loadConfigForDisplay(deps, workspaceRoot) |
| 412 | if err != nil { |
| 413 | return err |
| 414 | } |
| 415 | path := strings.TrimSpace(args[0]) |
| 416 | for _, entry := range flattenConfigEntries(redactedConfigMap(&cfg)) { |
| 417 | if entry.Path == path { |
| 418 | return writeCommandOutput(cmd, configValueBundle(configValueRecord(entry))) |
| 419 | } |
| 420 | } |
| 421 | return fmt.Errorf("cli: config path %q not found", path) |
| 422 | }, |
| 423 | } |
| 424 | cmd.Flags().StringVar(&workspaceRoot, "workspace", "", "Workspace root whose overlay should be included") |
| 425 | return cmd |
| 426 | } |
| 427 | |
| 428 | func newConfigSetCommand(deps commandDeps) *cobra.Command { |
| 429 | var ( |
no test coverage detected