cli

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleCommandError

func HandleCommandError(err error, usage string, description string, flagset *flag.FlagSet)

handleCommandAirer catches InvalidInput airer.Airers and prints usage if that was the error thrown. IF a different type of airer.Airer is thrown it just prints the error.

If the command succeeds handleCommandAirer exits the whole go process with code 0

func RunCommand

func RunCommand(tool_name string, tool_version string, command_list []Command)

func RunCommandRaw added in v0.0.4

func RunCommandRaw(tool_name string, tool_version string, command_list []Command)

The "Raw" version of RunCommand does not contain the default commands 'update version' and 'read nextz'.

func ShouldHaveArgs

func ShouldHaveArgs(num_args int, usage string, description string, flagset *flag.FlagSet)

shouldHaveArgs does two things:

  • validate that the number of args that aren't flags have been provided (i.e. the number of strings after the command name that aren't flags)
  • parse the remaining flags

If the wrong number of args is passed it prints helpful usage

Types

type Command

type Command struct {
	Verb        string
	Noun        string
	Supports    []string
	ExecutionFn func()
}

Jump to

Keyboard shortcuts

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