Example #1
0
func main() {
	cli := clif.New("My App", "1.0.0", "An example application").
		New("demo1", "Print demo table 1", printTable1).
		New("demo2", "Print demo table 2", printTable2).
		AddDefaultOptions(clif.NewFlag("open", "O", "Use open table style", false)).
		AddDefaultOptions(clif.NewOption("render-width", "w", "Render width of the table", fmt.Sprintf("%d", clif.TermWidthCurrent), false, false)).
		SetDefaultCommand("demo1")
	//cli.SetOutput(clif.NewDebugOutput(os.Stdout))
	cli.Run()
}
Example #2
0
func main() {
	clif.New("My App", "1.0.0", "An example application").
		New("demo1", "Print the progress bar 1", cmdProgress1).
		New("demo2", "Print the progress bar 2", cmdProgress2).
		New("demo3", "Print the progress bar 3", cmdProgress3).
		New("demo4", "Print the progress bar 3", cmdProgress4).
		AddDefaultOptions(clif.NewFlag("ascii-style", "A", "Use ASCII style instead", false)).
		AddDefaultOptions(clif.NewOption("width", "w", "Width of progress bars", fmt.Sprintf("%d", clif.TermWidthCurrent), false, false)).
		AddDefaultOptions(clif.NewOption("amount", "a", "Amount of progress bars", "3", false, false)).
		AddDefaultOptions(clif.NewOption("interval", "i", "Interval in miliseconds", "10", false, false)).
		SetDefaultCommand("demo1").
		Run()
}