MCPcopy Create free account
hub / github.com/ctoth/claudio / runInstallCommandE

Function runInstallCommandE

internal/cli/install_command.go:62–125  ·  view source on GitHub ↗

runInstallCommandE handles the install subcommand execution

(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

60
61// runInstallCommandE handles the install subcommand execution
62func runInstallCommandE(cmd *cobra.Command, args []string) error {
63 slog.Debug("install command started", "args", args)
64
65 // Get and validate scope flag
66 scopeStr, err := cmd.Flags().GetString("scope")
67 if err != nil {
68 return fmt.Errorf("failed to get scope flag: %w", err)
69 }
70
71 normalizedScope, err := install.NormalizeScope(scopeStr)
72 if err != nil {
73 return err
74 }
75 scope := InstallScope(normalizedScope)
76
77 // Get and validate agent flag
78 agentStr, err := cmd.Flags().GetString("agent")
79 if err != nil {
80 return fmt.Errorf("failed to get agent flag: %w", err)
81 }
82 agent, err := install.ParseAgent(agentStr)
83 if err != nil {
84 return err
85 }
86
87 // Get dry-run flag
88 dryRun, err := cmd.Flags().GetBool("dry-run")
89 if err != nil {
90 return fmt.Errorf("failed to get dry-run flag: %w", err)
91 }
92
93 // Get quiet flag
94 quiet, err := cmd.Flags().GetBool("quiet")
95 if err != nil {
96 return fmt.Errorf("failed to get quiet flag: %w", err)
97 }
98
99 // Get print flag
100 print, err := cmd.Flags().GetBool("print")
101 if err != nil {
102 return fmt.Errorf("failed to get print flag: %w", err)
103 }
104
105 slog.Info("install command executing", "scope", scope, "agent", agent, "dry_run", dryRun, "quiet", quiet, "print", print)
106
107 targets, err := install.ResolveAgentTargets(agent, scope.String())
108 if err != nil {
109 return err
110 }
111
112 slog.Debug("resolved install targets", "scope", scope, "agent", agent, "count", len(targets))
113
114 // Handle print flag - shows configuration details
115 if print {
116 return handlePrintInstall(cmd, scope, targets, dryRun, quiet)
117 }
118
119 // Handle dry-run mode - show what would be done without making changes

Callers

nothing calls this directly

Calls 8

NormalizeScopeFunction · 0.92
ParseAgentFunction · 0.92
ResolveAgentTargetsFunction · 0.92
InstallScopeTypeAlias · 0.85
handlePrintInstallFunction · 0.85
handleDryRunInstallFunction · 0.85
runInstallTargetsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected