Define command line options using struct tags
mainThe go-flags library uses Go structs and reflection to define command line options. You specify options by adding struct fields with specific tags. Supported tags include:
short: Single character short name (e.g.,short:"v"for-v).long: Long name (e.g.,long:"verbose"for--verbose).description: Help text for the option.required: Set to"true"to make the flag mandatory.choice: Restricts the input to a pre-defined set of strings (e.g.,choice:"cat" choice:"dog").value-name: The name used for the argument in the help message (e.g.,value-name:"FILE").default: The default value for the option.env: The environment variable name to use if the flag is not provided.env-delim: The delimiter used for environment variable values (e.g.,env-delim:",").
Supported types include all primitive Go types, slices (for multiple occurrences), maps, pointers, and function callbacks.
type Options struct {
Verbose []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
Name string `short:"n" long:"name" description:"A name" required:"true"`
Animal string `long:"animal" choice:"cat" choice:"dog"`
}