( cmd *cobra.Command, deps commandDeps, scopeRaw string, workspaceRoot string, args []string, )
| 445 | } |
| 446 | |
| 447 | func runConfigSetCommand( |
| 448 | cmd *cobra.Command, |
| 449 | deps commandDeps, |
| 450 | scopeRaw string, |
| 451 | workspaceRoot string, |
| 452 | args []string, |
| 453 | ) error { |
| 454 | if err := requireUnmanagedForMutation(deps, "set config values"); err != nil { |
| 455 | return err |
| 456 | } |
| 457 | homePaths, target, workspace, err := configWriteTarget(deps, scopeRaw, workspaceRoot) |
| 458 | if err != nil { |
| 459 | return err |
| 460 | } |
| 461 | if err := ensureWriteTargetParent(target); err != nil { |
| 462 | return err |
| 463 | } |
| 464 | path, kind, redacted, err := configMutationPath(args[0]) |
| 465 | if err != nil { |
| 466 | return err |
| 467 | } |
| 468 | lifecycle, err := classifyConfigSetLifecycle(path) |
| 469 | if err != nil { |
| 470 | return err |
| 471 | } |
| 472 | value, err := parseConfigSetValue(kind, args[1]) |
| 473 | if err != nil { |
| 474 | return err |
| 475 | } |
| 476 | liveRecord, err := maybeApplyConfigSetViaDaemon(cmd.Context(), deps, homePaths, target, path, value, redacted) |
| 477 | if err != nil { |
| 478 | return err |
| 479 | } |
| 480 | if liveRecord != nil { |
| 481 | return writeCommandOutput(cmd, configSetBundle(*liveRecord)) |
| 482 | } |
| 483 | if _, err := aghconfig.EditConfigOverlay(homePaths, workspace, target, func(editor *aghconfig.OverlayEditor) error { |
| 484 | return editor.SetValue(path, value) |
| 485 | }); err != nil { |
| 486 | return err |
| 487 | } |
| 488 | record := configSetRecordForLocalWrite(path, value, target, redacted, lifecycle) |
| 489 | reloadRecord, err := maybeReloadConfigAfterLocalWrite(cmd.Context(), deps, homePaths, target, record) |
| 490 | if err != nil { |
| 491 | return err |
| 492 | } |
| 493 | if reloadRecord != nil { |
| 494 | record = *reloadRecord |
| 495 | } |
| 496 | return writeCommandOutput(cmd, configSetBundle(record)) |
| 497 | } |
| 498 | |
| 499 | func configSetRecordForLocalWrite( |
| 500 | path []string, |
no test coverage detected