cmd

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = &lumberjack.Logger{
	Filename:   "",
	MaxSize:    25,
	MaxBackups: 10,
	MaxAge:     365,
	Compress:   false,
}

Logger for the cmd package

Functions

func AllCommands

func AllCommands(builder cli.Builder) []*cobra.Command

AllCommands returns a list of all the Commands.

func NewMenuCmd

func NewMenuCmd(b cli.Builder) cli.CliCommand

NewMenuCmd creates a new menu command.

Types

type App

type App struct {
	cli.CliCommand     // this is also the root command
	client.StoreFinder // for app.store()
	// contains filtered or unexported fields
}

App is the main app, the root command, and the Builder.

func CreateApp

func CreateApp(db *cache.DataBase, conf *cli.Config, out io.Writer) *App

CreateApp from a pre-created database and config.

func NewApp

func NewApp(out io.Writer) *App

NewApp creates a new app for the main cli.

func (*App) Address

func (a *App) Address() dawg.Address

Address returns the address.

func (*App) Build

func (a *App) Build(use, short string, r cli.Runner) *cli.Command

Build builds commands.

func (*App) Cleanup

func (a *App) Cleanup() (err error)

Cleanup cleans everything up.

func (*App) Config

func (a *App) Config() *cli.Config

Config returns the config struct.

func (*App) DB

func (a *App) DB() *cache.DataBase

DB returns the database

func (*App) GlobalOptions added in v0.0.3

func (a *App) GlobalOptions() *opts.CliFlags

GlobalOptions returns the variables for the app's global flags

func (*App) Init

func (a *App) Init(dir string) error

Init wil setup the app.

func (*App) InitDB

func (a *App) InitDB() (err error)

InitDB for the app.

func (*App) Run

func (a *App) Run(cmd *cobra.Command, args []string) (err error)

Run the app.

func (*App) SetConfig

func (a *App) SetConfig(dir string) error

SetConfig for the the app

type ErrMsg

type ErrMsg struct {
	Msg  string
	Code int
	Err  error
}

ErrMsg is not actually an error but it is my way of containing an error with a message and an exit code.

func Execute

func Execute(args []string, dir string) (msg *ErrMsg)

Execute runs the root command

Directories

Path Synopsis
obj
out

Jump to

Keyboard shortcuts

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