Documentation
¶
Overview ¶
Package gargsxd provides an argument type and parser similar to rargsxd (codeberg.org/BubbyRoosh/rargsxd) to use as an alternative to the flag library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Arg ¶
type Arg struct {
// Help contains the message that will be printed for the argument when
// PrintHelp is called.
Help string
// Short is the rune that is used when the argument is passed with `-`.
Short rune
// Long is the string that is used when the argument is passed with `--`.
Long string
// Value is the "generic" type for the value of the argument. When proper
// generics are fully implemented and official/stable, interface{} will be
// replaced.
Value interface{}
}
Struct Arg is the base argument type that will hold the information for each argument along with its Value.
type ArgParser ¶
type ArgParser struct {
// Name is the name of the program (automatically set by passing Argv0()).
Name string
// Author is the name of the program's author(s).
Author string
// Version is the stringified version of the program.
Version string
// Copyright is the copyright string for the program (as some licenses
// require something like "copyright (c) year name" somewhere in their
// program)
Copyright string
// Info is a small description of the program.
Info string
// Usage is the command-line usage of the program. All occurrences of
// "{name}" are replaced by Name. (Can be automatically set by using
// Usage())
Usage string
// Args holds the arguments that will be parsed, and can be set/accessed by
// their map name string.
Args map[string]Arg
// Extra holds any extra arguments that were not parsed with `-` or `--` or
// were a value of one.
Extra []string
// Writer is the writer for where the output should be printed (for the
// help menu). It will default to os.Stdout.
Writer io.Writer
}
Struct ArgParser is the main parser holding information about the program and its arguments.
func (*ArgParser) ParseSlice ¶
ParseSlice parses `args`, returning whether or not the parsing had errors.
Click to show internal directories.
Click to hide internal directories.
