Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Created December 21, 2014 14:21
Show Gist options
  • Save tmtk75/e39c75a72f373689ac45 to your computer and use it in GitHub Desktop.
Save tmtk75/e39c75a72f373689ac45 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"github.com/tmtk75/cli"
)
func main() {
app := cli.NewApp()
app.Name = "foo"
app.Args = "<id> [path] [name]"
app.Action = func(c *cli.Context) {
id, _ := c.ArgFor("id")
path, a := c.ArgFor("path")
name, b := c.ArgFor("name")
fmt.Printf("%v, %v:%v, %v:%v\n", id, path, a, name, b)
}
app.Run(os.Args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment