Skip to content

Commit

Permalink
Added --version set to 1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopaganini committed Mar 14, 2015
1 parent 3882cfb commit cd1096b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

const (
version = "1.0.0"
stateDirPrefix = ".bitrot"
stateFileMask = "bitrot_%x.db.gz"
stateDirMode = 0770
Expand All @@ -24,6 +25,7 @@ const (
type cmdLineOpts struct {
root string
verbose bool
version bool
}

// Globals -- Use with care
Expand Down Expand Up @@ -68,10 +70,16 @@ func stateDir() (string, error) {

// Parse command-line flags
func parseFlags() error {
flag.BoolVar(&Opt.version, "version", false, "Display version")
flag.BoolVar(&Opt.verbose, "verbose", false, "Verbose mode")
flag.BoolVar(&Opt.verbose, "v", false, "Verbose mode (shorthand)")
flag.Parse()

if Opt.version {
fmt.Println(version)
os.Exit(0)
}

if flag.NArg() != 1 {
usage("Error: Starting directory not specified.")
}
Expand Down Expand Up @@ -172,7 +180,6 @@ func main() {
if err != nil {
Log.Fatal(err)
}

if Opt.verbose {
Log.SetVerboseLevel(1)
}
Expand Down

0 comments on commit cd1096b

Please sign in to comment.