Skip to content

Commit

Permalink
Add versions flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Jun 15, 2018
1 parent d160b39 commit 3b133f5
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"os"
)

// ParseFlags parses flags provided by the user
func ParseFlags() {
// Setup custom help message
flag.Usage = func() {
fmt.Fprintf(os.Stderr, `Usage:
const (
version = "2.0"
help = `
Usage:
fac
Expand All @@ -36,8 +35,21 @@ Customizable variables:
Following variables may be defined in your $HOME/.fac.yml to customize behavior
`)
`
)

// ParseFlags parses flags provided by the user
func ParseFlags() {
// Setup custom help message
flag.Usage = func() {
fmt.Fprintf(os.Stderr, help)
}

showVersion := flag.Bool("version", false, "Print the version of fac being run")
flag.Parse()

if *showVersion {
fmt.Printf("fac version %s\n", version)
os.Exit(0)
}
}

0 comments on commit 3b133f5

Please sign in to comment.