INNER CODE UNIT · Go

parseOptions

cli/cli · .github/skills/cli-exercise/tool/internal/preflight/main.go:33

func parseOptions(args []string) (cliOptions, error) {
	var result cliOptions
	if len(args) == 0 || args[0] != "check" {
		return result, fmt.Errorf("preflight supports check only; setup is performed by the agent after caller approval")
	}
	flags := flag.NewFlagSet("preflight check", flag.ContinueOnError)
	flags.SetOutput(io.Discard)
	flags.StringVar(&result.output, "output", "", "Save the full report")
	flags.StringVar(&result.selections.ModuleRoot, "module-root", "", "Existing node_modules root")
	flags.StringVar(&result.selections.Node, "node", "", "Selected Node executable")
	flags.StringVar(&result.selections.FFmpeg, "ffmpeg", "", "Selected FFmpeg executable")
	flags.StringVar(&result.selections.FFprobe, "ffprobe", "", "Selected ffprobe executable")
	flags.Float64Var(&result.selections.ProbeTimeout, "probe-timeout", 20, "Per-process timeout in seconds")
	var formats formats
	flags.Var(&formats, "format", "Requested gif or mp4 output; repeat as needed")
	if err := flags.Parse(args[1:]); err != nil {
		return result, err
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…