Documentation
¶
Overview ¶
Package argparse provides a powerful command-line argument parser for Go applications.
Version: 1.0.0 Author: Dhruv Rawat GitHub: bunnyhawper
Index ¶
- Constants
- type Argument
- type ArgumentType
- type Command
- type Parser
- func (p *Parser) AddHelp() *Argument
- func (p *Parser) AddVersion() *Argument
- func (p *Parser) Bool(shortName, longName string, options *Argument) *Argument
- func (p *Parser) Counter(shortName, longName string, options *Argument) *Argument
- func (p *Parser) DateTime(shortName, longName string, options *Argument) *Argument
- func (p *Parser) Flag(shortName, longName string, options *Argument) *Argument
- func (p *Parser) Float(shortName, longName string, options *Argument) *Argument
- func (p *Parser) Get(name string) interface{}
- func (p *Parser) GetBool(name string) bool
- func (p *Parser) GetDateTime(name string) time.Time
- func (p *Parser) GetFloat(name string) float64
- func (p *Parser) GetInt(name string) int
- func (p *Parser) GetList(name string) []string
- func (p *Parser) GetString(name string) string
- func (p *Parser) Int(shortName, longName string, options *Argument) *Argument
- func (p *Parser) List(shortName, longName string, options *Argument) *Argument
- func (p *Parser) NewCommand(name string, description string) *Command
- func (p *Parser) Parse(args []string) (map[string]interface{}, error)
- func (p *Parser) ParseOrExit() map[string]interface{}
- func (p *Parser) Positional(name string, options *Argument) *Argument
- func (p *Parser) PrintHelp()
- func (p *Parser) SetEpilog(epilog string) *Parser
- func (p *Parser) SetVersion(version string) *Parser
- func (p *Parser) String(shortName, longName string, options *Argument) *Argument
Constants ¶
View Source
const ( Version = "1.0.0" Author = "Dhruv Rawat" GitHub = "bunnyhawper" )
Version information
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct { Name string ShortName string Description string IsRequired bool ArgType ArgumentType DefaultVal interface{} ValidChoices []string // contains filtered or unexported fields }
Argument represents a command-line argument
type ArgumentType ¶
type ArgumentType int
ArgumentType defines the type of an argument
const ( // String argument type String ArgumentType = iota // Int argument type Int // Float argument type Float // Bool argument type Bool // List argument type (multiple values) List // Counter argument type (counts occurrences) Counter // DateTime argument type DateTime )
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents the argument parser
func (*Parser) AddVersion ¶
AddVersion adds a version argument to the parser
func (*Parser) GetDateTime ¶
GetDateTime retrieves the datetime value of an argument
func (*Parser) NewCommand ¶
NewCommand creates a new subcommand
func (*Parser) ParseOrExit ¶
ParseOrExit parses command line arguments or exits on error
func (*Parser) Positional ¶
Positional adds a positional argument
func (*Parser) SetVersion ¶
SetVersion sets the version for the parser
Click to show internal directories.
Click to hide internal directories.