program

package module
v0.0.0-...-4ab3df8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2022 License: ISC Imports: 10 Imported by: 6 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name        string
	Description string
	Optional    bool
	Trailing    bool

	Set            bool
	Value          string
	TrailingValues []string
}

type BuildId

type BuildId struct {
	Major int
	Minor int
	Patch int

	NbCommits *int
	Revision  *string
}

func (BuildId) EqualTo

func (id1 BuildId) EqualTo(id2 BuildId) bool

func (BuildId) IsStable

func (id BuildId) IsStable() bool

func (BuildId) LowerThanOrEqualTo

func (id1 BuildId) LowerThanOrEqualTo(id2 BuildId) bool

func (*BuildId) Parse

func (id *BuildId) Parse(s string) error

func (BuildId) String

func (id BuildId) String() string

type Command

type Command struct {
	Name        string
	Description string
	Main        Main
	// contains filtered or unexported fields
}

func (*Command) AddArgument

func (c *Command) AddArgument(name, description string)

func (*Command) AddFlag

func (c *Command) AddFlag(shortName, longName, description string)

func (*Command) AddOption

func (c *Command) AddOption(shortName, longName, valueName, defaultValue, description string)

func (*Command) AddOptionalArgument

func (c *Command) AddOptionalArgument(name, description string)

func (*Command) AddTrailingArgument

func (c *Command) AddTrailingArgument(name, description string)

type Main

type Main func(*Program)

type Option

type Option struct {
	ShortName    string
	LongName     string
	ValueName    string
	DefaultValue string
	Description  string

	Set   bool
	Value string
}

type Program

type Program struct {
	Name        string
	Description string
	Main        Main

	Quiet      bool
	DebugLevel int
	// contains filtered or unexported fields
}

func NewProgram

func NewProgram(name, description string) *Program

func (*Program) AddArgument

func (p *Program) AddArgument(name, description string)

func (*Program) AddCommand

func (p *Program) AddCommand(name, description string, main Main) *Command

func (*Program) AddFlag

func (p *Program) AddFlag(shortName, longName, description string)

func (*Program) AddOption

func (p *Program) AddOption(shortName, longName, valueName, defaultValue, description string)

func (*Program) AddOptionalArgument

func (p *Program) AddOptionalArgument(name, description string)

func (*Program) AddTrailingArgument

func (p *Program) AddTrailingArgument(name, description string)

func (*Program) ArgumentValue

func (p *Program) ArgumentValue(name string) string

func (*Program) CommandName

func (p *Program) CommandName() string

func (*Program) Debug

func (p *Program) Debug(level int, format string, args ...interface{})

func (*Program) Error

func (p *Program) Error(format string, args ...interface{})

func (*Program) Fatal

func (p *Program) Fatal(format string, args ...interface{})

func (*Program) Info

func (p *Program) Info(format string, args ...interface{})

func (*Program) IsOptionSet

func (p *Program) IsOptionSet(name string) bool

func (*Program) OptionValue

func (p *Program) OptionValue(name string) string

func (*Program) ParseCommandLine

func (p *Program) ParseCommandLine()

func (*Program) PrintUsage

func (p *Program) PrintUsage(command *Command)

func (*Program) Run

func (p *Program) Run()

func (*Program) SetMain

func (p *Program) SetMain(main Main)

func (*Program) TrailingArgumentValues

func (p *Program) TrailingArgumentValues(name string) []string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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