cli

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: BSD-3-Clause Imports: 13 Imported by: 60

README

package cli

cli is a Golang package to encourage a more consistant command line user interface in programs written for Caltech Library.

Features include:

  • A common Cli object generated with cli.NewCli() representing configuration, environment and command line
    • environment and options share the same approach as Go's standard flag package
    • options support multiple options (long/short version) in option's flag string separating options by comma
    • generate help and usage, sysnopsis, options, examples, license based on programaticly
  • A common Create, Open and Close file wrapper for integrating standard in/out/err as fallback
  • The Cli object supports the following functions
    • AppName() returns the compiled application name
    • AddParams() for documenting required and optional non-option parameters
    • AddAction() for git/go stale verb with parameters ui
    • AddHelp() for adding help topics by page name
    • Help() string for searching your help topics by page name
    • Usage() string builds a page for show general help - usage, description, options and examples
    • License() string builds a license page as a string
    • Version() string builds a version string
    • Run() for running defined actions and returning an exit code suitable for passing to os.Exit()
    • GenerateMarkdownDocs() for generating documentation based on how the program in implemented

Documentation

Overview

*

  • cli is a package intended to encourage some standardization in the command line user interface for programs
  • developed for Caltech Library. *
  • @author R. S. Doiel, <rsdoiel@caltech.edu> *
  • Copyright (c) 2016, Caltech
  • All rights not granted herein are expressly reserved by Caltech. *
  • Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
  • 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
  • 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
  • 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
  • THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *

*

  • cli is a package intended to encourage some standardization in the command line user interface for programs
  • developed for Caltech Library. *
  • @author R. S. Doiel, <rsdoiel@caltech.edu> *
  • Copyright (c) 2016, Caltech
  • All rights not granted herein are expressly reserved by Caltech. *
  • Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
  • 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
  • 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
  • 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
  • THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *

*

  • cli is a package intended to encourage some standardization in the command line user interface for programs
  • developed for Caltech Library. *
  • @author R. S. Doiel, <rsdoiel@caltech.edu> *
  • Copyright (c) 2016, Caltech
  • All rights not granted herein are expressly reserved by Caltech. *
  • Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
  • 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
  • 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *
  • 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. *
  • THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *

generator.go - provides a quick and dirty skeleton for cli based apps.

manpage.go - adds man page output formatting suitable for running through `nroff -man` and rendering a man page. It is a part of the cli page.

Author: R. S. Doiel, <rsdoiel@library.caltech.edu>

Copyright (c) 2018, Caltech All rights not granted herein are expressly reserved by Caltech.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

markdown.go - this is a part of the cli package. This code focuses on generating Markdown docs from the internal help information.

usage.go - handles rendering the "usage" message for cli package

Index

Constants

View Source
const Version = `v0.0.13`

Variables

This section is empty.

Functions

func CloseFile

func CloseFile(filename string, fp *os.File) error

CloseFile accepts a filename and os.File pointer, if filename is "" or "-" it skips the close otherwise is does a fp.Close() on the file.

func Create

func Create(filename string, fallbackFile *os.File) (*os.File, error)

Create accepts a filename, fallbackFile (usually os.Stdout, os.Stdin, os.Stderr) and returns a file pointer and error. It is a conviences function for wrapping stdin, stdout, stderr If filename is "-" or filename is "" then fallbackFile is used.

func ExitOnError

func ExitOnError(out *os.File, err error, quiet bool)

ExitOnError is used by the cli programs to handle exit cuasing errors constitantly. E.g. it respects the -quiet flag past to it.

func Generate added in v0.0.13

func Generate(appName, synopsis, author, descriptionFName, examplesFName, bugsFName, licenseFName string) []byte

Generate creates main.go source code

func IsPipe

func IsPipe(in *os.File) bool

IsPipe accepts a file pointer and returns true if data on file pointer is from a pipe or false if not.

func OnError

func OnError(out *os.File, err error, quiet bool)

OnError writes an error message to out if err != nil taking into consideration the state of quiet

func Open

func Open(filename string, fallbackFile *os.File) (*os.File, error)

Open accepts a filename, fallbackFile (usually os.Stdout, os.Stdin, os.Stderr) and returns a file pointer and error. It is a conviences function for wrapping stdin, stdout, stderr If filename is "-" or filename is "" then fallbackFile is used.

func PopArg

func PopArg(args []string) (string, []string)

PopArg takes an array pops the last element returning the element and an updated array. If no elements are left then a empty string and nil are turned.

func PushArg added in v0.0.13

func PushArg(s string, args []string) []string

PushArg takes and array and adds a string to the end

func ReadLines

func ReadLines(in *os.File) ([]string, error)

ReadLines accepts a file pointer to read and returns an array of lines.

func ShiftArg added in v0.0.13

func ShiftArg(args []string) (string, []string)

ShiftArg takes an array of strings and if array is not empty returns a string and the rest of the args. If array is empty it returns an empty string, when there are no more args it returns nil for the arg parameter

func UnshiftArg added in v0.0.13

func UnshiftArg(s string, args []string) []string

Unshift takes a string and an array of strings and returns a new array with the value of string as the first element and the rest are elements of the array of strings

Types

type Action

type Action struct {
	// Name is usually a verb like list, test, build as needed by the cli
	Name string
	// Fn is action that will be run by Cli.Run() if Name is the first non-option arg on the command line
	//NOTE: currently the signature is io based but may be changed to *os.File in
	// the future
	Fn func(io.Reader, io.Writer, io.Writer, []string) int
	// Usage is a short description of what the action does and description of any expected additoinal parameters
	Usage string
}

Action describes an "action" that a cli might take. Actions aren't prefixed with a "-".

func (*Action) String

func (a *Action) String() string

String prints an actions' verb and description

type Cli

type Cli struct {
	// In is usually set to os.Stdin
	In *os.File
	// Out is usually set to os.Stdout
	Out *os.File
	// Eout is usually set to os.Stderr
	Eout *os.File
	// Documentation specific help pages, e.g. -help example1
	Documentation map[string][]byte
	// SectionNo is the numeric value section value for man page generation
	SectionNo int

	// ActionsRequired is true then the USAGE line shows ACTION rather than [ACTION]
	ActionsRequired bool
	// contains filtered or unexported fields
}

Cli models the metadata for running a common cli program

func NewCli

func NewCli(version string) *Cli

NewCli creates an Cli instance, an Cli describes the running of the command line interface making it easy to expose the functionality in packages as command line tools.

func (*Cli) Action

func (c *Cli) Action(verb string) string

Action returns a doc string for a given verb

func (*Cli) Actions

func (c *Cli) Actions() map[string]string

Actions returns a map of actions and their doc strings

func (*Cli) AddAction

func (c *Cli) AddAction(verb string, fn func(io.Reader, io.Writer, io.Writer, []string) int, usage string) error

AddAction associates a wrapping function with a action name, the wrapping function has 4 parameters in io.Reader, out io.Writer, err io.Writer, args []string. It should return an integer reflecting an exit code like you'd pass to os.Exit().

func (*Cli) AddHelp

func (c *Cli) AddHelp(keyword string, usage []byte) error

AddHelp takes a string keyword and byte slice of content and updates the Documentation attribute

func (*Cli) AddParams

func (c *Cli) AddParams(params ...string)

Add Params documents any parameters not defined as Options or Actions, it is an orders list of strings

func (*Cli) AddVerb added in v0.0.13

func (c *Cli) AddVerb(verb string, usage string) error

AddVerb associates documentation with a verb without assigning a function (e.g. if you aren't going to use cli.Run() so we don't need an "Action" only the docs

func (*Cli) AppName

func (c *Cli) AppName() string

AppName returns the application name as a string

func (*Cli) Arg

func (c *Cli) Arg(i int) string

Arg returns an argument by pos index

func (*Cli) Args

func (c *Cli) Args() []string

Args returns flag.Args()

func (*Cli) BoolVar

func (c *Cli) BoolVar(p *bool, names string, value bool, usage string)

BoolVar updates c.options doc strings, then splits options and calls flag.BoolVar()

func (*Cli) DurationVar

func (c *Cli) DurationVar(p *time.Duration, names string, value time.Duration, usage string)

DurationVar updates c.options doc strings, then splits options and calls flag.DurationVar()

func (*Cli) Env

func (c *Cli) Env(name string) string

Env returns an EnvAttribute documentation string for matching name

func (*Cli) EnvAttribute

func (c *Cli) EnvAttribute(name string) (*EnvAttribute, error)

EnvAttribute returns the struct corresponding to the matchine name

func (*Cli) EnvBool

func (c *Cli) EnvBool(name string, value bool, usage string) *bool

EnvBool adds an environment variable which is evaluate before evaluating options returns a pointer to the value.

func (*Cli) EnvBoolVar

func (c *Cli) EnvBoolVar(p *bool, name string, value bool, usage string) error

EnvBoolVar adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.BoolVar()

func (*Cli) EnvDuration

func (c *Cli) EnvDuration(name string, value time.Duration, usage string) *time.Duration

EnvDuration adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.DurationVar()

func (*Cli) EnvDurationVar

func (c *Cli) EnvDurationVar(p *time.Duration, name string, value time.Duration, usage string) error

EnvDurationVar adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.DurationVar()

func (*Cli) EnvFloat64

func (c *Cli) EnvFloat64(name string, value float64, usage string) *float64

EnvFloat64 adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.Float64Var()

func (*Cli) EnvInt

func (c *Cli) EnvInt(name string, value int, usage string) *int

EnvInt adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.IntVar()

func (*Cli) EnvInt64

func (c *Cli) EnvInt64(name string, value int64, usage string) *int64

EnvInt64 adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.Int64Var()

func (*Cli) EnvInt64Var

func (c *Cli) EnvInt64Var(p *int64, name string, value int64, usage string) error

EnvInt64Var adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.Int64Var()

func (*Cli) EnvIntVar

func (c *Cli) EnvIntVar(p *int, name string, value int, usage string) error

EnvIntVar adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.IntVar()

func (*Cli) EnvString

func (c *Cli) EnvString(name string, value string, usage string) *string

EnvString adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.StringVar()

func (*Cli) EnvStringVar

func (c *Cli) EnvStringVar(p *string, name string, value string, usage string) error

EnvStringVar adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.StringVar()

func (*Cli) EnvUint

func (c *Cli) EnvUint(name string, value uint, usage string) *uint

EnvUint adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.UintVar()

func (*Cli) EnvUint64

func (c *Cli) EnvUint64(name string, value uint64, usage string) *uint64

EnvUint64 adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.Uint64Var()

func (*Cli) EnvUint64Var

func (c *Cli) EnvUint64Var(p *uint64, name string, value uint64, usage string) error

EnvUint64Var adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.Uint64Var()

func (*Cli) EnvUintVar

func (c *Cli) EnvUintVar(p *uint, name string, value uint, usage string) error

EnvUintVar adds environment variable which is evaluate before evaluating options It is the environment counterpart to flag.UintVar()

func (*Cli) Float64Var

func (c *Cli) Float64Var(p *float64, names string, value float64, usage string)

Float64Var updates c.options doc strings, then splits options and calls flag.Float64Var()

func (*Cli) GenerateManPage added in v0.0.13

func (c *Cli) GenerateManPage(w io.Writer)

GenerateManPage writes a manual page suitable for running through `nroff --man`. May need some human clean up depending on content and internal formatting (e.g markdown style, spacing, etc.)

func (*Cli) GenerateMarkdown added in v0.0.13

func (c *Cli) GenerateMarkdown(w io.Writer)

GenerateMarkdown writes a Markdown page to io.Writer provided. Documentation is based on the application's metadata like app name, version, options, actions, etc.

func (*Cli) Getenv

func (c *Cli) Getenv(name string) string

Getenv returns a given environment attribute value as a string

func (*Cli) Help

func (c *Cli) Help(keywords ...string) string

Help returns documentation on a topic

func (*Cli) Int64Var

func (c *Cli) Int64Var(p *int64, names string, value int64, usage string)

Int64Var updates c.options doc strings, then splits options and calls flag.Int64Var()

func (*Cli) IntVar

func (c *Cli) IntVar(p *int, names string, value int, usage string)

IntVar updates c.options doc strings, then splits options and calls flag.IntVar()

func (*Cli) License

func (c *Cli) License() string

func (*Cli) NArg

func (c *Cli) NArg() int

NArg returns flag.NArg()

func (*Cli) Option

func (c *Cli) Option(op string) string

Option returns an option's document string or unsupported string

func (*Cli) Options

func (c *Cli) Options() map[string]string

Options returns a map of option values and doc strings

func (*Cli) Parse

func (c *Cli) Parse() error

Parse process both the environment and any flags

func (*Cli) ParseEnv

func (c *Cli) ParseEnv() error

ParseEnv loops through the os environment using os.Getenv() and updates c.env EnvAttribute. Returns an error if there is a problem with environment.

func (*Cli) ParseOptions

func (c *Cli) ParseOptions()

ParseOptions envokes flag.Parse() updating variables set in AddOptions

func (*Cli) Run

func (c *Cli) Run(args []string) int

(c *Cli) Run takes a list of non-option arguments and runs them if the fist arg (i.e. arg[0] has a corresponding action. Returns an int suitable to passing to os.Exit()

func (*Cli) StringVar

func (c *Cli) StringVar(p *string, names string, value string, usage string)

StringVar updates c.options doc strings, then splits options and calls flag.StringVar()

func (*Cli) Uint64Var

func (c *Cli) Uint64Var(p *uint64, names string, value uint64, usage string)

Uint64Var updates c.options doc strings, then splits options and calls flag.Int64Var()

func (*Cli) UintVar

func (c *Cli) UintVar(p *uint, names string, value uint, usage string)

UintVar updates c.options doc strings, then splits options and calls flag.Int64Var()

func (*Cli) Usage

func (c *Cli) Usage(w io.Writer)

Usage writes a help page to io.Writer provided. Documentation is based on the application's metadata like app name, version, options, actions, etc.

func (*Cli) Verb added in v0.0.13

func (c *Cli) Verb(args []string) string

Verb returns the verb in an arg list without poping the verb. If arg list is empty then an empty string is returned.

func (*Cli) Version

func (c *Cli) Version() string

type Config

type Config struct {
	EnvPrefix       string `json:"env_prefix"`
	LicenseText     string `json:"license_text"`
	VersionText     string `json:"version_text"`
	UsageText       string `json:"usage_text"`
	DescriptionText string `json:"description_text"`
	ExampleText     string `json:"example_text"`
	OptionText      string `json:"option_text"`

	// Options are the running options for an application, often this can be expressed as a cli
	// parameter or an environment variable.
	Options map[string]string `json:"options"`
	// contains filtered or unexported fields
}

Config holds the merged environment and options selected when the program runs DEPRECIATED

func New

func New(appName, envPrefix, version string) *Config

New returns an initialized Config structure DEPRECIATED

func (*Config) AddExample

func (cfg *Config) AddExample(topic, text string)

AddExample takes a topic and example text and adds it to the examples index DEPRECIATED

func (*Config) AddHelp

func (cfg *Config) AddHelp(topic, text string)

AddTopic takes a topic and text and address it to the help index DEPRECIATED

func (*Config) CheckOption

func (cfg *Config) CheckOption(envVar, value string, required bool) string

CheckOption checks the trimmer string value, if len is 0, log an error message and if required is true exit(1) else return the value passed in. DEPRECIATED

func (*Config) Example

func (cfg *Config) Example(topics ...string) string

Example formats example topics DEPRECIATED

func (*Config) Get

func (cfg *Config) Get(key string) string

Get returns the associate value of the key in the Config struct's Options DEPRECIATED

func (*Config) Help

func (cfg *Config) Help(topics ...string) string

Help formats a help topics DEPRECIATED

func (*Config) License

func (cfg *Config) License() string

License returns a string containing the application's license DEPRECIATED

func (*Config) MergeEnv

func (cfg *Config) MergeEnv(envVar, flagValue string) string

MergeEnv merge environment variables into the configuration structure. options are + prefix - e.g. EPGO, name space before the first underscore in the envinronment

  • prefix plus uppercase key forms the complete environment variable name

+ key - the field map (e.g ApiURL maps to API_URL in EPGO_API_URL for prefix EPGO) + proposedValue - the proposed value, usually the value from the flags passed in (an empty string means no value provided)

returns the new value of the environment string merged DEPRECIATED

func (*Config) MergeEnvBool

func (cfg *Config) MergeEnvBool(envVar string, flagValue bool) bool

MergeEnvBool till pick use flagValue if present, otherwise is the environment value. It returns the value selected (e.g. useful when combined with CheckOption() DEPRECIATED

func (*Config) StandardOptions

func (cfg *Config) StandardOptions(showHelp, showExamples, showLicense, showVersion bool, args []string) string

StandardOptions() processing the booleans associated with standard options and any additional cli parameters in args return text as a string. DEPRECIATED

func (*Config) Usage

func (cfg *Config) Usage() string

Usage returns a string describe how to use the cli, includes USAGE, SYNOPSIS, OPTIONS, etc. DEPRECIATED

func (*Config) Version

func (cfg *Config) Version() string

Version returns a string containing the application's version DEPRECIATED

type EnvAttribute

type EnvAttribute struct {
	// Name is the environment variable (e.g. DATASET, USERNAME)
	Name string
	// Type holds the type name of the attribute, e.g. int, int64, float64, string, bool, uint, uint64, time.Duration
	Type string
	// BoolValue holds the default boolean
	BoolValue bool
	// IntValue holds the default int
	IntValue int
	// Int64Value holds the default int64
	Int64Value int64
	// UintValue holds the default uint
	UintValue uint
	// Uint64Value holds the default uint64
	Uint64Value uint64
	// Float64Value holds the default float64
	Float64Value float64
	// Dura1tionValue holds the default time.Duration
	DurationValue time.Duration
	// StringValue holds the default string
	StringValue string
	// Usage describes the environment variable role and expected setting
	Usage string
}

EnvAttribute describes expected environmental attributes associated with the cli app. It also provides the default value of the environmental attribute if missing from the environment.

Directories

Path Synopsis
cmd
cligenerate command
cligenerate is a cli application generator, e.g.
cligenerate is a cli application generator, e.g.

Jump to

Keyboard shortcuts

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