Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //Version is taken by the build flags, represent current version as //<major>.<minor>.<patch> Version string //Commit is the output of `git rev-parse HEAD` at the moment of the build Commit string //Build contains info about the scope of the build and should either be Debug or Release Build string = "Debug" )
View Source
var WaptyCommands []*Cmd
WaptyCommands is the list of all wapty commands available. Each command `cmd` is invoked via `wapty cmd`
Functions ¶
func AddCommand ¶
func AddCommand(c *Cmd)
AddCommand allows packages to setup their own command. In order for them to be compiled, they must be imported by the main package with the "_" alias
func Printbanner ¶
func Printbanner()
Types ¶
type Cmd ¶
type Cmd struct { // Name is the name of the command. It's what comes after `wapty`. Name string // Run is the command entrypoint. Run func(...string) // UsageLine is the header of what's printed by flag.PrintDefaults. UsageLine string // Short is a one-line description of what the command does. Short string // Long is the detailed description of what the command does. Long string // Flag is the set of flags accepted by the command. This should be initialized in // the command's module's `init` function. The parsing of these flags is issued // by the main wapty entrypoint, so each command doesn't have to do it itself. Flag flag.FlagSet }
Cmd is used by any package exposing a runnable command to gather information about command name, usage and flagset.
var DefaultCommand *Cmd
func FindCommand ¶
FindCommand takes a string and searches for a command whose name has that string as prefix. If more than 1 command name has that string as a prefix (and no command name equals that string), an error is returned. If no suitable command is found, an error is returned.
Click to show internal directories.
Click to hide internal directories.