Skip to content

Commit 5ff5a25

Browse files
committed
support --version and print the version on verbose mode, fixes #2
1 parent 4a1d05f commit 5ff5a25

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/pipet/main.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ import (
2121

2222
func main() {
2323
log.SetFlags(log.Lshortfile | log.Ltime)
24-
24+
cli.VersionFlag = &cli.BoolFlag{
25+
Name: "version",
26+
Usage: "print the pipet version",
27+
}
2528
app := &cli.App{
2629
Name: "pipet",
2730
Usage: "swiss-army tool for web scraping, made for hackers",
2831
HideHelpCommand: true,
2932
UseShortOptionHandling: true,
3033
EnableBashCompletion: true,
34+
Version: "0.3.0",
3135
ArgsUsage: "<pipet_file>",
36+
3237
Flags: []cli.Flag{
3338
&cli.BoolFlag{
3439
Name: "json",
@@ -78,6 +83,7 @@ func main() {
7883
}
7984

8085
if err := app.Run(os.Args); err != nil {
86+
log.Println("pipet version", app.Version)
8187
log.Fatal(err)
8288
}
8389
}

0 commit comments

Comments
 (0)