MCPcopy Create free account
hub / github.com/github/gh-aw / resolveAuditCommandArgs

Function resolveAuditCommandArgs

pkg/cli/audit.go:157–185  ·  view source on GitHub ↗
(args []string, stdin bool)

Source from the content-addressed store, hash-verified

155}
156
157func resolveAuditCommandArgs(args []string, stdin bool) ([]string, bool, error) {
158 if stdin {
159 if len(args) > 0 {
160 return nil, false, errors.New(console.FormatErrorWithSuggestions(
161 "positional arguments are not allowed with --stdin",
162 []string{"Remove the run ID arguments, or omit --stdin to use positional arguments"},
163 ))
164 }
165 stdinURLs, err := readRunIDsFromStdin(os.Stdin)
166 if err != nil {
167 return nil, false, fmt.Errorf("failed to read run IDs from stdin: %w", err)
168 }
169 if len(stdinURLs) == 0 {
170 fmt.Fprintln(os.Stderr, console.FormatWarningMessage("No run IDs or URLs provided on stdin"))
171 return nil, true, nil
172 }
173 args = stdinURLs
174 }
175 if len(args) == 0 {
176 return nil, false, errors.New(console.FormatErrorWithSuggestions(
177 "at least one run ID or URL is required",
178 []string{
179 "Provide a run ID or URL as a positional argument",
180 "Use --stdin to read run IDs from stdin (one per line)",
181 },
182 ))
183 }
184 return args, false, nil
185}
186
187func runAuditSingle(ctx context.Context, runIDOrURL string, opts auditCommandOptions) error {
188 components, err := parser.ParseRunURLExtended(runIDOrURL)

Callers 1

runAuditCommandFunction · 0.85

Calls 4

FormatWarningMessageFunction · 0.92
readRunIDsFromStdinFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected