(args []string, stdin bool)
| 155 | } |
| 156 | |
| 157 | func 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 | |
| 187 | func runAuditSingle(ctx context.Context, runIDOrURL string, opts auditCommandOptions) error { |
| 188 | components, err := parser.ParseRunURLExtended(runIDOrURL) |
no test coverage detected