console

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package console provides a feature to implement CLI commands into your aah application easily and extensible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppHelpTemplate

func AppHelpTemplate(t string)

AppHelpTemplate method sets the custom text/template for application help. Console uses text/template to render templates.

func CommandHelpTemplate

func CommandHelpTemplate(t string)

CommandHelpTemplate method sets the custom text/template for command help. Console uses text/template to render templates.

func HelpFlagDesc

func HelpFlagDesc(desc string)

HelpFlagDesc method customized flag name, desc for HelpFlag.

func ShowAppHelp

func ShowAppHelp(c *Context) error

ShowAppHelp is an action that displays the help.

func ShowAppHelpAndExit

func ShowAppHelpAndExit(c *Context, exitCode int)

ShowAppHelpAndExit - Prints the list of subcommands for the app and exits with exit code.

func ShowCommandHelp

func ShowCommandHelp(c *Context, cmd string) error

ShowCommandHelp prints help for the given command

func ShowCommandHelpAndExit

func ShowCommandHelpAndExit(c *Context, cmd string, code int)

ShowCommandHelpAndExit - exits with code after showing help

func ShowSubcommandHelp

func ShowSubcommandHelp(c *Context) error

ShowSubcommandHelp prints help for the given subcommand.

func ShowVersion

func ShowVersion(c *Context)

ShowVersion prints the version number of the App.

func SubcommandHelpTemplate

func SubcommandHelpTemplate(t string)

SubcommandHelpTemplate method sets the custom text/template for sub-command help. Console uses text/template to render templates.

func VersionFlagDesc

func VersionFlagDesc(desc string)

VersionFlagDesc method customized flag name, desc for VersionFlag.

func VersionPrinter

func VersionPrinter(vp func(*Context))

VersionPrinter method set custom func for version printer.

Types

type Application

type Application = cli.App

Application is the main structure of a console application. It is recommended that an app be created with the func `console.NewApp()`.

func NewApp

func NewApp() *Application

NewApp creates a new console Application with some reasonable defaults for Name, Usage, Version and Action.

type Args

type Args = cli.Args

Args contains apps console arguments

type Author

type Author = cli.Author

Author represents someone who has contributed to a console project.

type BoolFlag

type BoolFlag = cli.BoolFlag

BoolFlag is a flag with type bool

type Command

type Command = cli.Command

Command returns the named command on App. Returns nil if the command does not exist

type CommandsByName

type CommandsByName = cli.CommandsByName

CommandsByName is a sorter interface for commands.

type Context

type Context = cli.Context

Context is a type that is passed through to each Handler action in a console application. Context can be used to retrieve context-specific Args and parsed command-line options.

func NewContext

func NewContext(app *Application, set *flag.FlagSet, parentCtx *Context) *Context

NewContext creates a new context. For use in when invoking an App or Command action.

type Flag

type Flag = cli.Flag

Flag is a common interface related to parsing flags in console. For more advanced flag parsing techniques, it is recommended that this interface be implemented.

type FlagsByName

type FlagsByName = cli.FlagsByName

FlagsByName is a sorter interface for flags.

type Float64Flag

type Float64Flag = cli.Float64Flag

Float64Flag is a flag with type float64

type Int64Flag

type Int64Flag = cli.Int64Flag

Int64Flag is a flag with type int64

type IntFlag

type IntFlag = cli.IntFlag

IntFlag is a flag with type int

type IntSlice

type IntSlice = cli.IntSlice

IntSlice is an opaque type for []int to satisfy flag.Value and flag.

type StringFlag

type StringFlag = cli.StringFlag

StringFlag is a flag with type string

type StringSlice

type StringSlice = cli.StringSlice

StringSlice is an opaque type for []string to satisfy flag.Value and flag.

Jump to

Keyboard shortcuts

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