Skip to content

Commit

Permalink
Add -v flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Guilmont committed Jul 1, 2020
1 parent 2f3bee6 commit e100710
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import (

const esJSONPrefix = "_source."

// Export variables for version
var (
GitSummary string
GitCommit string
BuildDate string
)

func currentFilter(contextFilter string, cliFilter string) string {
if cliFilter != "" {
return cliFilter
Expand All @@ -34,10 +41,21 @@ func main() {
flag.PrintDefaults()

}

version := flag.Bool("v", false, "Display version.")

from := flag.String("from", "now-10m", "Start timestamp.")
to := flag.String("to", "", "End timestamp. By default there's no end timestamp, it will infinitely loop.")
filter := flag.String("filter", "", "Overide filter in your context")
flag.Parse()

if *version {
fmt.Printf("Version: %v\n", GitSummary)
fmt.Printf("Commit hash: %v\n", GitCommit)
fmt.Printf("Build date: %v\n", BuildDate)
os.Exit(0)
}

if len(flag.Args()) != 1 {
fmt.Println("Invalid usage")

Expand Down

0 comments on commit e100710

Please sign in to comment.