Skip to content

Commit

Permalink
support --version and print the version on verbose mode, fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
bjesus committed Oct 12, 2024
1 parent 4a1d05f commit 5ff5a25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/pipet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ import (

func main() {
log.SetFlags(log.Lshortfile | log.Ltime)

cli.VersionFlag = &cli.BoolFlag{
Name: "version",
Usage: "print the pipet version",
}
app := &cli.App{
Name: "pipet",
Usage: "swiss-army tool for web scraping, made for hackers",
HideHelpCommand: true,
UseShortOptionHandling: true,
EnableBashCompletion: true,
Version: "0.3.0",
ArgsUsage: "<pipet_file>",

Flags: []cli.Flag{
&cli.BoolFlag{
Name: "json",
Expand Down Expand Up @@ -78,6 +83,7 @@ func main() {
}

if err := app.Run(os.Args); err != nil {
log.Println("pipet version", app.Version)
log.Fatal(err)
}
}
Expand Down

0 comments on commit 5ff5a25

Please sign in to comment.