Turning cli into a package

This commit is contained in:
Jeremy Saenz 2013-07-13 13:07:14 -07:00
parent e830a4195e
commit 372b86498f

36
cli.go
View File

@ -1,38 +1,4 @@
package main
import "os"
func main() {
App{
Name: "math",
Description: "a simple command line math utility",
Commands: []Command{{
Name: "add",
Description: "Add 2 and 2",
Action: func(name string) {
println("2+2=", 2+2)
},
}, {
Name: "subtract",
Description: "Subtract 2 and 2",
Action: func(name string) {
println("2-2=", 2-2)
},
}, {
Name: "multiply",
Description: "Multiply 2 and 2",
Action: func(name string) {
println("2*2=", 2*2)
},
}, {
Name: "divide",
Description: "Divide 2 and 2",
Action: func(name string) {
println("2/2=", 2/2)
},
}},
}.Run(os.Args[1])
}
package cli
type App struct {
Name string