MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / parseAgentFlags

Function parseAgentFlags

cmd/chief/main.go:128–157  ·  view source on GitHub ↗

parseAgentFlags extracts --agent and --agent-path from args[startIdx:], returning the agent name, agent path, remaining args (with agent flags removed), and the updated index offsets. It exits on missing values.

(args []string, startIdx int)

Source from the content-addressed store, hash-verified

126// returning the agent name, agent path, remaining args (with agent flags removed),
127// and the updated index offsets. It exits on missing values.
128func parseAgentFlags(args []string, startIdx int) (agentName, agentPath string, remaining []string) {
129 for i := startIdx; i < len(args); i++ {
130 arg := args[i]
131 switch {
132 case arg == "--agent":
133 if i+1 < len(args) {
134 i++
135 agentName = args[i]
136 } else {
137 fmt.Fprintf(os.Stderr, "Error: --agent requires a value (claude, codex, opencode, or cursor)\n")
138 os.Exit(1)
139 }
140 case strings.HasPrefix(arg, "--agent="):
141 agentName = strings.TrimPrefix(arg, "--agent=")
142 case arg == "--agent-path":
143 if i+1 < len(args) {
144 i++
145 agentPath = args[i]
146 } else {
147 fmt.Fprintf(os.Stderr, "Error: --agent-path requires a value\n")
148 os.Exit(1)
149 }
150 case strings.HasPrefix(arg, "--agent-path="):
151 agentPath = strings.TrimPrefix(arg, "--agent-path=")
152 default:
153 remaining = append(remaining, arg)
154 }
155 }
156 return
157}
158
159// parseTUIFlags parses command-line flags for TUI mode
160func parseTUIFlags() *TUIOptions {

Callers 3

parseTUIFlagsFunction · 0.85
runNewFunction · 0.85
runEditFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected