Documentation ¶
Overview ¶
This is a Basic Implementation of a text ui that can be used to run CLI commands or you can define your own HandlerCommand to run Go functions Basic Structure is: Menu
[]Command []Args
By default a CLI command handler is provided that is able to pass parameters as flag, options or Enviroment variables
You can find an example app in the /example folder
Index ¶
- func OSCmdHandler(c *Command, ch chan string)
- type Argument
- type Command
- type HandlerCommand
- type Menu
- func (m *Menu) BreadCrum() string
- func (m *Menu) CurrentCommand() *Command
- func (menu *Menu) EventCommandManager()
- func (menu *Menu) EventManager()
- func (m *Menu) IsToggle() bool
- func (m *Menu) Next()
- func (m *Menu) NextArgument()
- func (m *Menu) Prev()
- func (m *Menu) Quit()
- func (m *Menu) RunCommand(c *Command)
- func (m *Menu) SelectToggle()
- func (m *Menu) Show()
- func (m *Menu) ShowCommand()
- func (m *Menu) ShowResult(c *Command)
- type Printing
- func (p *Printing) Bottom()
- func (p *Printing) BottomBar(str string)
- func (p *Printing) Clear()
- func (p *Printing) Put(str string, highlight bool)
- func (p *Printing) PutEcho(str string, style tcell.Style)
- func (p *Printing) PutH1(str string, highlight bool)
- func (p *Printing) Putln(str string, highlight bool)
- func (p *Printing) PutlnDisable(str string)
- func (p *Printing) Return()
- func (p *Printing) Screen() tcell.Screen
- func (p *Printing) Show()
- func (p *Printing) Sync()
- func (p *Printing) Top()
- type ProgressBar
- type Style
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OSCmdHandler ¶
OS execution default handler Error in command is updated in completion
Types ¶
type Argument ¶
type Argument struct { Envar string Name string IsFlag bool Title string Description string Value string IsBoolean bool Valuebool bool }
Argument can be a flag (IsFlag) or a Envar (if defined). If IsFalg is false the Name is passed without a - appended IsBoolean means that the argument is passed with no additional value flag bool: -foo flag: -foo bar noflag bool: foo
type Command ¶
type HandlerCommand ¶
type def for a handler function, pass a command and a channel to return screen stdout, channel will be close when execution is completed
type Menu ¶
type Menu struct { Title string Description string Commands []Command Cursor int BottomBar bool BottomBarText string //text for default top menu BackText string //text for back text on command BoolText string //text when an arg is a bool ValueText string //text when an arg is a value string Wait chan int //channel to wait completion // contains filtered or unexported fields }
func (*Menu) CurrentCommand ¶
func (*Menu) EventCommandManager ¶
func (menu *Menu) EventCommandManager()
Handles key events for commnands
func (*Menu) NextArgument ¶
func (m *Menu) NextArgument()
Moves menu to the Next Argument in a Command
func (*Menu) RunCommand ¶
Run commands and waits to complete, then calls menu ShowResult
func (*Menu) SelectToggle ¶
func (m *Menu) SelectToggle()
func (*Menu) ShowCommand ¶
func (m *Menu) ShowCommand()
Displays a command in the screen as incated by Cursor in Menu
func (*Menu) ShowResult ¶
Displays result of running a command, using test Fail and Success, plus adds error message for Fail
type Printing ¶
type Printing struct { Cursor int // contains filtered or unexported fields }
func (*Printing) Putln ¶
adds a ln with a return at the end. hightlight uses the highlight style for the full line text
func (*Printing) PutlnDisable ¶
add a line disabled style
type ProgressBar ¶
func NewProgressBar ¶
func NewProgressBar(p *Printing) *ProgressBar
func (*ProgressBar) Start ¶
func (p *ProgressBar) Start()
func (*ProgressBar) Stop ¶
func (p *ProgressBar) Stop()