base

package
v0.0.0-...-feb7e18 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Automation enables automation-friendly JSON output.
	Automation bool `short:"A" long:"automation" description:"Whether to output in automation friendly JSON format." optional:"yes"`
	// Parameters are a set of <key>:<value> or <key>=<value> pairs, that ca be used for substitution in inputs.
	Parameters []Parameter `short:"P" long:"parameter" description:"A set of parameters, in <key>:<value> format." optional:"yes"`
}

Command collects the base set of options in common to all commands.

func (*Command) BindVariables

func (cmd *Command) BindVariables(value string) string

BindVariables provides a way to bind variables in strings with parameters provided either in the environment, or on the command line as '--parameter' pairs. In order to bind all variables in a string do as follows:

cmd.Bind("{env:SOME_ENV_VAR}={cli:key1}+{cli:key2}")

and it will be bound according to the following rules:

  • variables of the form {env:<ENVVAR>} are bound to the corresponding environment variable
  • variables of the forma {cli:<PARAM>} are bound to the corresponding parameter as provided on the command line via the command line switch.

type Parameter

type Parameter struct {
	Key   string
	Value string
}

Parameter represents a parameter that can be used to values in configuration files.

func (*Parameter) UnmarshalFlag

func (p *Parameter) UnmarshalFlag(value string) error

Jump to

Keyboard shortcuts

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