grim/resticide

32bc94f303e2
Parents 92fb02aef02c
Children f8bc0c4813a9
Give the --help output some tlc, also added a --version argument
  • +1 -1
    Makefile
  • +17 -1
    main.go
  • --- a/Makefile Sat Jul 09 15:15:35 2016 -0500
    +++ b/Makefile Sat Jul 09 15:48:36 2016 -0500
    @@ -39,4 +39,4 @@
    go test -cover -v ./...
    check-functional: check
    - $(TARGET) -host https://httpbin.org -path tests
    + $(TARGET) --host=https://httpbin.org --path=tests
    --- a/main.go Sat Jul 09 15:15:35 2016 -0500
    +++ b/main.go Sat Jul 09 15:48:36 2016 -0500
    @@ -1,25 +1,41 @@
    package main
    import (
    - "flag"
    "fmt"
    "net/url"
    "os"
    "runtime"
    + flag "gopkg.in/ogier/pflag.v0"
    +
    "bitbucket.org/rw_grim/resticide/loader"
    "bitbucket.org/rw_grim/resticide/reporter"
    "bitbucket.org/rw_grim/resticide/runner"
    )
    +const (
    + resticideVersion = "0.1"
    +)
    +
    func main() {
    + flag.Usage = func() {
    + fmt.Fprintf(os.Stderr, "Usage: resticide [OPTIONS]\n\nOptions:\n")
    + flag.PrintDefaults()
    + }
    +
    testDir := flag.String("path", "resticide", "The path to search for tests")
    verbose := flag.Bool("verbose", false, "Whether or not to use verbose output")
    + version := flag.Bool("version", false, "Show the version and exit")
    host := flag.String("host", "", "The hostname to use")
    workers := flag.Int("workers", runtime.NumCPU(), "How many workers to use to run tests")
    flag.Parse()
    + if *version {
    + fmt.Fprintf(os.Stderr, "resticide v%s\n", resticideVersion)
    + os.Exit(0)
    + }
    +
    if *host == "" {
    fmt.Printf("You must specify a host\n")