Skip to content

Instantly share code, notes, and snippets.

@kyoh86
Last active October 6, 2015 04:35
Show Gist options
  • Save kyoh86/499c0f6125dd990e55af to your computer and use it in GitHub Desktop.
Save kyoh86/499c0f6125dd990e55af to your computer and use it in GitHub Desktop.
kingpin.app.go
package main
import (
"os"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
type Conf struct {
Hoge string `json:"hoge"`
Bar bool `json:"bar"`
}
func main() {
conf := Conf{}
app := kingpin.New("kinpin.App", "Sample for kingpin.App")
app.Flag("hoge", "Hoge").Short('h').Default("fuga").ExistingFileVar(&conf.Hoge)
app.Flag("foo", "Foo").Short('f').BoolVar(&conf.Bar)
app.Parse(os.Args[1:])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment