Skip to content

Commit

Permalink
add versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemackintosh committed Feb 19, 2023
1 parent ec1605d commit 4171ee7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"log"
"ninetails/config"
"ninetails/version"
"os"
"sync"
)
Expand All @@ -15,6 +16,7 @@ var (
/* */
flagWithFilename bool
flagWithLinenum bool
flagVersion bool

/* */
flagConfig string
Expand All @@ -23,13 +25,19 @@ var (
func init() {
flag.BoolVar(&flagWithFilename, "H", false, "Display filename")
flag.BoolVar(&flagWithLinenum, "n", false, "Display linenum")
flag.BoolVar(&flagVersion, "v", false, "Display version")
flag.StringVar(&flagConfig, "c", ".ninetail.yml", "Configuration file")
}

func main() {
// Parse the config
flag.Parse()

if flagVersion {
fmt.Printf("%s - %s\n", version.Version, version.CommitHash)
os.Exit(0)
}

if err := config.Parse(flagConfig); err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 4171ee7

Please sign in to comment.