-
Notifications
You must be signed in to change notification settings - Fork 0
QuickStart
christophberger edited this page Oct 19, 2017
·
1 revision
import (
"github.com/christophberger/start"
)start imports pflag, so you can start right away setting up your POSIX compliant flags:
var ip *int = flag.Int("repeat", "r", 1, "Define how often the message gets printed.")start.Add(&start.Command{
Name: "echo",
Short: "Print a message.",
Long: "Prints its arguments as a message to stdout.",
Flags: []string{"repeat"},
Cmd: echo
})
func echo(cmd *start.Command) error {
args := "no args."
if len(cmd.Args) > 0 {
args = cmd.Args
}
for ( i := 0; i < *ip; i++) {
stdio.Println(args)
}
}<application>.toml
repeat = 2bash$ export <application>_repeat=3start.Up()