package main import ( "surdeus.su/core/cli/mtool" "strconv" "fmt" "os" "strings" ) var ( root = mtool.T("test").Subs( mtool.T("echo").Func(func(flags *mtool.Flags) { var ( b bool n int ) flags.BoolVar(&b, "u", false, "convert to uppercase", "UPPERCASE") flags.IntVar(&n, "n", 1, "amount of times to print", "NUMPRINT", "NUMPRINT1") args := flags.Parse() if b { for i, arg := range args { args[i] = strings.ToUpper(arg) } } for i:=0 ; i ", ), mtool.T("sub").Subs( mtool.T("first").Func(func(flags *mtool.Flags) { fmt.Println("called the first", flags.Parse()) }).Desc( "first sub tool", ), mtool.T("second").Func(func(flags *mtool.Flags) { fmt.Println("called the second", flags.Parse()) }).Desc( "second sub tool", ), ).Desc( "the tool to demonstrate how subtools work", ), ).Desc( "the testing program to show how to use the lib", ).Ldesc( "this is the long description where you " + "can put anything you want about the program", ) ) func main() { root.Run(os.Args[1:]) }