Turning cli into a package

main
Jeremy Saenz 11 years ago
parent e830a4195e
commit 372b86498f

@ -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

Loading…
Cancel
Save