Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArgumentsSubparser ¶
type ArgumentsSubparser struct {
Banner string
ShowBannerOnHelp bool
ShowBannerOnRun bool
Name string
Value *string
CaseInsensitive bool
SubParsers map[string]*parser.ArgumentsParser
}
The ArgumentsParser is designed to handle command-line argument parsing for applications. It supports both positional and named arguments, organizes them into groups, and provides detailed usage information. The parser keeps track of argument names and their values, ensuring that all required arguments are accounted for.
Attributes:
Banner (string): A string displayed before parsing begins, often used to show the program's name or purpose. PositionalArguments ([]*positionals.PositionalArgument): A list of pointers to positional arguments managed by the parser. DefaultGroup (*argumentgroup.ArgumentGroup): A pointer to the default group for organizing arguments, if applicable. shortNameToArgument (map[string]arguments.Argument): A map linking short flag names (e.g., "-v") to their argument structures. longNameToArgument (map[string]arguments.Argument): A map linking long flag names (e.g., "--verbose") to their argument structures. requiredArguments ([]arguments.Argument): A list of pointers to arguments that must be provided for successful execution. allArguments ([]arguments.Argument): A list of all arguments, both positional and named, managed by the parser. Groups (map[string]*argumentgroup.ArgumentGroup): A map organizing related arguments into named subgroups for clarity and structure.
func (*ArgumentsSubparser) AddSubParser ¶
func (asp *ArgumentsSubparser) AddSubParser(name, banner string) *parser.ArgumentsParser
NewSubparser creates a new subparser with the specified name.
Parameters: - name: The name of the subparser. - help: The help message of the subparser.
Returns: - A pointer to the newly created subparser.
func (*ArgumentsSubparser) Parse ¶
func (asp *ArgumentsSubparser) Parse()
Parse parses the arguments and returns the parsed arguments.
Returns: - A map of parsed arguments.
func (*ArgumentsSubparser) Usage ¶
func (asp *ArgumentsSubparser) Usage()
Usage prints the usage information for the subparser.
Returns: - A map of parsed arguments.