Skip to content

Commit

Permalink
Add show version
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Nov 2, 2022
1 parent 70b2baa commit d41c3e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/codecrafters/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ COMMANDS
}

help := flag.Bool("help", false, "show usage instructions")
showVersion := flag.Bool("version", false, "print version and exit")
flag.Parse()

if *help {
flag.Usage()
os.Exit(0)
}

if *showVersion {
fmt.Println(fmt.Sprintf("codecrafters %s", utils.VersionString()))
os.Exit(0)
}

cmd := flag.Arg(0)

switch cmd {
Expand Down

0 comments on commit d41c3e0

Please sign in to comment.