Skip to content

Commit

Permalink
Merge pull request #8 from film42/schinn/version_flag
Browse files Browse the repository at this point in the history
added version flag
  • Loading branch information
schinns authored Aug 26, 2020
2 parents b44ad06 + 26c3de4 commit 33e22bc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -80,12 +82,21 @@ func (hc *HealthCheckWebService) apiGetIsReplica(w http.ResponseWriter, r *http.
}

func main() {
versionPtr := flag.Bool("version", false, "Print the teecp version and exit.")
flag.Parse()

if *versionPtr {
fmt.Println("1.0.0")
return
}

if len(os.Args) < 2 {
panic(errors.New("Please provide a path to config yml."))
}
pathToConfig := os.Args[1]

cfg, err := config.ParseConfig(pathToConfig)

if err != nil {
panic(err)
}
Expand Down

0 comments on commit 33e22bc

Please sign in to comment.