cmder

package
v0.0.0-...-c6ea6ab Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: LGPL-3.0 Imports: 5 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VersionModule = NewModule("version").
	SetUsage("Show version detail").
	SetAction(versionAction)

VersionModule provide module of version, Set nil to disable version command

Functions

func Main

func Main(module Module, commandModules ...Module)

Main entry point

func NewApp

func NewApp(module Module, commandModules ...Module) *cli.App

NewApp return *cli.App with module and command modules

func NewCommand

func NewCommand(module Module, usedModules ...Module) cli.Command

NewCommand return cli.Command with module

func WrapAction

func WrapAction(action cli.ActionFunc) cli.ActionFunc

WrapAction wrap action with default error handler

func WrapMainAction

func WrapMainAction(action cli.ActionFunc) cli.ActionFunc

WrapMainAction wrap main action with default error handler and command helper

Types

type Actions

type Actions []cli.ActionFunc

Actions slice of cli.ActionFunc

func (*Actions) Add

func (t *Actions) Add(actions ...cli.ActionFunc)

Add action

func (Actions) Wrap

func (t Actions) Wrap() cli.ActionFunc

Wrap return wrapped function for running all actions with WrapAction

func (Actions) WrapMain

func (t Actions) WrapMain(mainAction cli.ActionFunc) cli.ActionFunc

WrapMain return wrapped function for running all actions with WrapMainAction

type Module

type Module struct {
	Name   string
	Usage  string
	Flags  []cli.Flag
	Before cli.ActionFunc
	Action cli.ActionFunc
	After  cli.ActionFunc
	Depend Modules
}

Module for cli, used for cli.App or cli.Command

func NewModule

func NewModule(name string) *Module

NewModule create Module instance

func (*Module) AddDepend

func (t *Module) AddDepend(modules ...*Module) *Module

AddDepend add dependent module

func (*Module) AddFlag

func (t *Module) AddFlag(flags ...cli.Flag) *Module

AddFlag add cli.Flag to Module

func (*Module) SetAction

func (t *Module) SetAction(action cli.ActionFunc) *Module

SetAction set Module action

func (*Module) SetAfter

func (t *Module) SetAfter(action cli.ActionFunc) *Module

SetAfter set Module after action

func (*Module) SetBefore

func (t *Module) SetBefore(action cli.ActionFunc) *Module

SetBefore set Module before action

func (*Module) SetUsage

func (t *Module) SetUsage(usage string) *Module

SetUsage set Module usage

type Modules

type Modules []*Module

Modules slice of Module

func (Modules) Actions

func (t Modules) Actions(usedModules ...Module) Actions

Actions return all actions in Modules

func (Modules) AfterActions

func (t Modules) AfterActions(usedModules ...Module) Actions

AfterActions return all after actions in Modules

func (Modules) BeforeActions

func (t Modules) BeforeActions(usedModules ...Module) Actions

BeforeActions return all before actions in Modules

func (Modules) DependOnce

func (t Modules) DependOnce(usedModules ...Module) Modules

DependOnce return all dependent modules but only show once if depend multiple times

func (Modules) Flags

func (t Modules) Flags(usedModules ...Module) []cli.Flag

Flags return all flags in Modules

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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