goNixArgParser

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: MIT, MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfigArgs added in v1.15.3

func LoadConfigArgs(filename string) (args []string, err error)

func SplitToArgs added in v1.15.3

func SplitToArgs(input string) (args []string)

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(
	names []string,
	summary, mergeFlagPrefix string,
	restsSigns, groupSeps, assignSigns, undefFlagPrefixes []string,
) *Command

func NewSimpleCommand

func NewSimpleCommand(name, summary string, aliasNames ...string) *Command

func (*Command) GetSubCommand

func (c *Command) GetSubCommand(name string) *Command

func (*Command) Name

func (c *Command) Name() (name string)

func (*Command) Names added in v1.1.0

func (c *Command) Names() []string

func (*Command) NewSimpleSubCommand

func (c *Command) NewSimpleSubCommand(name, summary string, aliasNames ...string) *Command

func (*Command) NewSubCommand

func (c *Command) NewSubCommand(
	names []string,
	summary, mergeFlagPrefix string,
	restsSigns, groupSeps, assignSigns, undefFlagPrefixes []string,
) *Command

func (*Command) Options added in v1.1.0

func (c *Command) Options() *OptionSet

func (*Command) OutputHelp added in v1.14.0

func (c *Command) OutputHelp(w io.Writer)

func (*Command) Parse

func (c *Command) Parse(specifiedArgs, configArgs []string) *ParseResult

func (*Command) ParseGroups

func (c *Command) ParseGroups(specifiedArgs, configArgs []string) (results []*ParseResult)

func (*Command) SubCommands

func (c *Command) SubCommands() []*Command

func (*Command) Summary

func (c *Command) Summary() string

type Flag

type Flag struct {
	Name string
	// contains filtered or unexported fields
}

func NewFlag

func NewFlag(name string, prefixMatchLen int, canMerge, canFollowAssign, canConcatAssign bool) *Flag

func NewSimpleFlag

func NewSimpleFlag(name string) *Flag

func NewSimpleFlags

func NewSimpleFlags(names []string) []*Flag

type Option

type Option struct {
	Key           string
	Summary       string
	Description   string
	Flags         []*Flag
	AcceptValue   bool
	MultiValues   bool
	OverridePrev  bool
	Delimiters    []rune
	UniqueValues  bool
	EnvVars       []string
	DefaultValues []string
	Hidden        bool
}

func NewFlagOption added in v1.8.0

func NewFlagOption(key, flag, envVar, summary string) Option

func NewFlagValueOption added in v1.8.0

func NewFlagValueOption(key, flag, envVar, defaultValue, summary string) Option

func NewFlagValuesOption added in v1.8.0

func NewFlagValuesOption(key, flag, envVar string, defaultValues []string, summary string) Option

func NewFlagsOption added in v1.8.0

func NewFlagsOption(key string, flags []string, envVar, summary string) Option

func NewFlagsValueOption added in v1.8.0

func NewFlagsValueOption(key string, flags []string, envVar, defaultValue, summary string) Option

func NewFlagsValuesOption added in v1.8.0

func NewFlagsValuesOption(key string, flags []string, envVar string, defaultValues []string, summary string) Option

func (*Option) OutputHelp added in v1.14.0

func (opt *Option) OutputHelp(w io.Writer)

type OptionSet

type OptionSet struct {
	// contains filtered or unexported fields
}

func NewOptionSet

func NewOptionSet(
	mergeFlagPrefix string,
	restsSigns []string,
	groupSeps []string,
	assignSigns []string,
	undefFlagPrefixes []string,
) *OptionSet

func NewSimpleOptionSet

func NewSimpleOptionSet() *OptionSet

func (*OptionSet) Add added in v1.8.0

func (s *OptionSet) Add(opt Option) error

func (*OptionSet) AddFlag

func (s *OptionSet) AddFlag(key, flag, envVar, summary string) error

func (*OptionSet) AddFlagValue

func (s *OptionSet) AddFlagValue(key, flag, envVar, defaultValue, summary string) error

func (*OptionSet) AddFlagValues

func (s *OptionSet) AddFlagValues(key, flag, envVar string, defaultValues []string, summary string) error

func (*OptionSet) AddFlags

func (s *OptionSet) AddFlags(key string, flags []string, envVar, summary string) error

func (*OptionSet) AddFlagsValue

func (s *OptionSet) AddFlagsValue(key string, flags []string, envVar, defaultValue, summary string) error

func (*OptionSet) AddFlagsValues

func (s *OptionSet) AddFlagsValues(key string, flags []string, envVar string, defaultValues []string, summary string) error

func (*OptionSet) GroupSeps

func (s *OptionSet) GroupSeps() []string

func (*OptionSet) MergeFlagPrefix added in v1.1.0

func (s *OptionSet) MergeFlagPrefix() string

func (*OptionSet) OutputHelp added in v1.14.0

func (s *OptionSet) OutputHelp(w io.Writer)

func (*OptionSet) Parse

func (s *OptionSet) Parse(specifiedArgs, configArgs []string) *ParseResult

func (*OptionSet) ParseGroups

func (s *OptionSet) ParseGroups(specifiedArgs, configArgs []string) []*ParseResult

func (*OptionSet) RestsSigns

func (s *OptionSet) RestsSigns() []string

func (*OptionSet) UndefFlagPrefixes added in v1.6.1

func (s *OptionSet) UndefFlagPrefixes() []string

type ParseResult

type ParseResult struct {
	// contains filtered or unexported fields
}

func (*ParseResult) GetAmbigus added in v1.8.0

func (r *ParseResult) GetAmbigus() []string

func (*ParseResult) GetBool

func (r *ParseResult) GetBool(key string) (value bool, found bool)

func (*ParseResult) GetBools

func (r *ParseResult) GetBools(key string) (values []bool, found bool)

func (*ParseResult) GetCommands

func (r *ParseResult) GetCommands() []string

func (*ParseResult) GetFloat64

func (r *ParseResult) GetFloat64(key string) (value float64, found bool)

func (*ParseResult) GetFloat64s

func (r *ParseResult) GetFloat64s(key string) (values []float64, found bool)

func (*ParseResult) GetInt

func (r *ParseResult) GetInt(key string) (value int, found bool)

func (*ParseResult) GetInt64

func (r *ParseResult) GetInt64(key string) (value int64, found bool)

func (*ParseResult) GetInt64s

func (r *ParseResult) GetInt64s(key string) (values []int64, found bool)

func (*ParseResult) GetInts

func (r *ParseResult) GetInts(key string) (values []int, found bool)

func (*ParseResult) GetRests

func (r *ParseResult) GetRests() (rests []string)

func (*ParseResult) GetString

func (r *ParseResult) GetString(key string) (value string, found bool)

func (*ParseResult) GetStrings

func (r *ParseResult) GetStrings(key string) (values []string, found bool)

func (*ParseResult) GetUint64

func (r *ParseResult) GetUint64(key string) (value uint64, found bool)

func (*ParseResult) GetUint64s

func (r *ParseResult) GetUint64s(key string) (values []uint64, found bool)

func (*ParseResult) GetUndefs added in v1.6.1

func (r *ParseResult) GetUndefs() []string

func (*ParseResult) HasAmbigu added in v1.8.0

func (r *ParseResult) HasAmbigu() bool

func (*ParseResult) HasConfigKey

func (r *ParseResult) HasConfigKey(key string) bool

func (*ParseResult) HasConfigValue

func (r *ParseResult) HasConfigValue(key string) bool

func (*ParseResult) HasDefaultKey

func (r *ParseResult) HasDefaultKey(key string) bool

func (*ParseResult) HasDefaultValue

func (r *ParseResult) HasDefaultValue(key string) bool

func (*ParseResult) HasEnvKey

func (r *ParseResult) HasEnvKey(key string) bool

func (*ParseResult) HasEnvValue

func (r *ParseResult) HasEnvValue(key string) bool

func (*ParseResult) HasFlagKey

func (r *ParseResult) HasFlagKey(key string) bool

func (*ParseResult) HasFlagValue

func (r *ParseResult) HasFlagValue(key string) bool

func (*ParseResult) HasKey

func (r *ParseResult) HasKey(key string) bool

func (*ParseResult) HasUndef added in v1.6.1

func (r *ParseResult) HasUndef() bool

func (*ParseResult) HasValue

func (r *ParseResult) HasValue(key string) bool

func (*ParseResult) SetConfigOption added in v1.14.0

func (r *ParseResult) SetConfigOption(key, value string)

func (*ParseResult) SetConfigOptions added in v1.14.0

func (r *ParseResult) SetConfigOptions(key string, values []string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL