Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
-version flag. close #28.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorinvo committed Jan 6, 2017
1 parent d29453c commit afbf7ca
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import (
"fmt"
"log"
"os"
"runtime"

"qvl.io/ghbackup/ghbackup"
)

const version = "v1.2"

const (
// Printed for -help, -h or with wrong number of arguments
usage = `Embarrassing simple Github backup tool
Expand All @@ -34,6 +37,7 @@ func main() {
// Flags
account := flag.String("account", "", accountUsage)
secret := flag.String("secret", "", secretUsage)
versionFlag := flag.Bool("version", false, "Print binary version")
silent := flag.Bool("silent", false, "Surpress all output")

// Parse args
Expand All @@ -43,6 +47,12 @@ func main() {
fmt.Fprintln(os.Stderr, more)
}
flag.Parse()

if *versionFlag {
fmt.Printf("ghbackup %s %s %s\n", version, runtime.GOOS, runtime.GOARCH)
os.Exit(0)
}

args := flag.Args()
if len(args) != 1 || (*account == "" && *secret == "") {
flag.Usage()
Expand Down

0 comments on commit afbf7ca

Please sign in to comment.