2022-06-16 09:02:24 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import(
|
2023-03-23 12:32:52 +03:00
|
|
|
mtool "github.com/surdeus/gomtool/src/multitool"
|
2022-06-16 09:02:24 +03:00
|
|
|
"strconv"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
var(
|
2023-03-23 12:32:52 +03:00
|
|
|
tools = mtool.Tools{
|
|
|
|
"echo" : mtool.Tool{
|
|
|
|
func(args []string, flags *mtool.Flags) {
|
|
|
|
var b bool
|
|
|
|
flags.BoolVar(&b, "b", false, "the check flag")
|
|
|
|
flags.Parse(args)
|
|
|
|
fmt.Println(flags.Args())
|
2022-10-11 15:38:48 +03:00
|
|
|
},
|
|
|
|
"print string to standard output string",
|
2023-03-23 12:32:52 +03:00
|
|
|
"[str1 str2 ... strN]",
|
2022-06-16 09:02:24 +03:00
|
|
|
},
|
2023-03-23 12:32:52 +03:00
|
|
|
"sum" : mtool.Tool{
|
|
|
|
func(args []string, flags *mtool.Flags) {
|
|
|
|
flags.Parse(args)
|
2022-10-11 15:38:48 +03:00
|
|
|
one, _ := strconv.Atoi(args[1])
|
|
|
|
two, _ := strconv.Atoi(args[2])
|
|
|
|
fmt.Println(one + two)
|
|
|
|
},
|
|
|
|
"add one value to another",
|
2023-03-23 12:32:52 +03:00
|
|
|
"<int1> <int2>",
|
2022-06-16 09:02:24 +03:00
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-03-23 12:32:52 +03:00
|
|
|
mtool.Main("test", tools)
|
2022-06-16 09:02:24 +03:00
|
|
|
}
|
|
|
|
|