Last active
October 6, 2015 04:35
-
-
Save kyoh86/499c0f6125dd990e55af to your computer and use it in GitHub Desktop.
kingpin.app.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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