cmd

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SUCCESS is an alias of exit status code to ease read.
	SUCCESS int = 0
	// FAILURE is an alias of exit status code to ease read.
	FAILURE int = 1
)

Variables

View Source
var (
	// ConfApp is the basic app settings.
	ConfApp = conf.TConfigFile{
		PathDirConf:        ".",
		NameFileConf:       "config",
		NameTypeConf:       "yaml",
		PathFileConf:       ".gopress",
		IsUsingDefaultConf: false,
	}

	// ConfUser holds the values read from the config file. The values here are
	// the default.
	ConfUser = TConfUser{
		Template: "default",
	}
)

Functions

func EchoStdErrIfError

func EchoStdErrIfError(err error) int

EchoStdErrIfError is an STDERR wrapper and returns 0(zero) or 1. It does nothing if the error is nil and returns 0.

func Execute

func Execute() error

Execute is the main function of `cmd` package. It adds all the child commands to the root's command tree and sets their flag settings. Then runs/executes the `rootCmd` to find appropriate matches for child commands with corresponding flags and args.

Usually `cmd.Execute` will be called by the `main.main()` and it only needs to happen once to the rootCmd. Returns `error` when it fails to execute.

Types

type TConfUser

type TConfUser struct {
	Template string `mapstructure:"template"`
}

TConfUser defines the data structure to store values from a conf file. Viper will read these values from the config file or env variables. `mapstructure` defines the key name in the conf file.

type TypePropertyInit

type TypePropertyInit struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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