cmd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Rev represents the revision. When built via CI, this is replaced with Git
	// SHA1 by the linker.
	Rev string = "HEAD"
	// Ver represents the version. When built via CI, this is replaced with Git
	// tag it's built with.
	Ver string = "development version"
)

Functions

func AliasCmd

func AliasCmd() *cobra.Command

AliasCmd returns a pointer to the aliasCmd variable for the alias subcommands that are in a separate package.

func DefaultConfigFile

func DefaultConfigFile() string

DefaultConfigFile returns the specified config file name or the default if one has not beeen specified.

func DefaultDir

func DefaultDir() string

DefaultDir returns the standard directory for the aliasman configuration data.

BUG(patsoffice) this is very UNIX centric. BUG(patsoffice) this function should return an eror and not exit from here

func EmailProvider

func EmailProvider() (email.Provider, error)

EmailProvider returns an email provider of the type specified in a Viper string. If a provider that is specified does not exist or there was a problem creating the provider, an error is returned.

func ErrorExit

func ErrorExit(err error, cmd *cobra.Command)

ErrorExit takes an error value and possibly pointer to a Cobra command. The error value is printed to stderr. If the pointer to the Cobra command is non-nil, it's Help() method is run. THe program is then run with a non-zero exit value.

BUG(patsoffice) allow exit values to be passed? Necessary? BUG(patsoffice) allow setting of a Writer so that something other than stderr can be used?

func ErrorNoExit

func ErrorNoExit(err error)

ErrorNoExit takes and error value and outputs it to stderr. BUG(patsoffice) allow setting of a Writer so that something other than stderr can be used?

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func RootCmd

func RootCmd() *cobra.Command

RootCmd returns a pointer to the root command so that other modules can manipulate it. This primarily so providers can add their options to the global flags via their init() funtions.

func StorageProvider

func StorageProvider() (storage.Provider, error)

StorageProvider returns a storage provider of the type specified in a Viper string. If a provider that is specified does not exist or there was a problem creating the provider, an error is returned.

func ValidateInputs

func ValidateInputs(domain, alias *string, emailAddresses *[]string) error

ValidateInputs ensures that valid input is provided for domain, alias and email addresses. If empty input is given for domain and email addresses, we attempt to retrieve defaults from the Viper configuration.

Types

This section is empty.

Notes

Bugs

  • this is very UNIX centric.

  • this function should return an eror and not exit from here

  • this is very UNIX centric. Different for different platforms?

  • allow exit values to be passed? Necessary?

  • allow setting of a Writer so that something other than stderr can be used?

  • allow setting of a Writer so that something other than stderr can be used?

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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