cmd

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: Apache-2.0, BSD-3-Clause, MIT Imports: 18 Imported by: 0

Documentation

Overview

Package cmd implements the command line interface

Package cmd implements the command line interface

Index

Constants

This section is empty.

Variables

View Source
var App = &cli.App{
	Name:  "gcy",
	Usage: "gcy COMMAND CONFIG_FILE [KEYPATH]",
	Authors: []*cli.Author{
		&cli.Author{
			Name:  "Blink Health",
			Email: "opensource@blinkhealth.com",
		},
	},
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "verbose",
			Value:   false,
			Aliases: []string{"v"},
			Usage:   "Print debug statements",
		},
	},
	Before: func(ctx *cli.Context) error {
		if ctx.Bool("verbose") {
			log.SetLevel(log.DebugLevel)
			if ctx.IsSet("generate-bash-completion") {
				return nil
			}
			log.Debug("Verbose output enabled")
		}
		return nil
	},
	Commands:             []*cli.Command{},
	EnableBashCompletion: true,
	BashComplete:         autocomplete.CommandAutocomplete,
	CommandNotFound: func(ctx *cli.Context, name string) {

		_ = cli.ShowAppHelp(ctx)
		log.Errorf("Unknown command <%s>", name)
		os.Exit(1)
	},
}
View Source
var KeyFlags = util.KeyFlags()

Functions

func Exit

func Exit(message interface{}, code ExitCode) error

Exit creates a new CommandError

func Main

func Main(version string)

Main main function for go-config-yourself

Types

type CommandError

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

CommandError encodes a message and exit codes

func (CommandError) Code

func (err CommandError) Code() int

Code returns the error code

func (CommandError) Error

func (err CommandError) Error() string

type ExitCode

type ExitCode int

ExitCode enumerates error codes available to commands

const (
	// ExitCodeToolError means we did something silly
	ExitCodeToolError ExitCode = 2
	// ExitCodeInputError means the user did something silly
	ExitCodeInputError ExitCode = 99
)

Directories

Path Synopsis
Package autocomplete provides helpers for shell completion
Package autocomplete provides helpers for shell completion
Package util supports the go-config-yourself commands and CLI
Package util supports the go-config-yourself commands and CLI

Jump to

Keyboard shortcuts

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