Skip to content

Commit

Permalink
added --version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Feb 23, 2017
1 parent 3fb2ea2 commit 260fd61
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.go
Expand Up @@ -10,6 +10,10 @@ import (
"github.com/splitsh/lite/splitter"
)

var (
version = "dev"
)

type prefixesFlag []*splitter.Prefix

func (p *prefixesFlag) String() string {
Expand Down Expand Up @@ -38,7 +42,7 @@ func (p *prefixesFlag) Set(value string) error {

var prefixes prefixesFlag
var origin, target, commit, path, gitVersion string
var scratch, debug, quiet, legacy, progress bool
var scratch, debug, quiet, legacy, progress, v bool

func init() {
flag.Var(&prefixes, "prefix", "The directory(ies) to split")
Expand All @@ -52,11 +56,17 @@ func init() {
flag.BoolVar(&legacy, "legacy", false, "[DEPRECATED] Enable the legacy mode for projects migrating from an old version of git subtree split (optional)")
flag.StringVar(&gitVersion, "git", "latest", "Simulate a given version of Git (optional)")
flag.BoolVar(&progress, "progress", false, "Show progress bar (optional, cannot be enabled when debug is enabled)")
flag.BoolVar(&v, "version", false, "Show version")
}

func main() {
flag.Parse()

if v {
fmt.Printf("splitsh-lite version %s\n", version)
os.Exit(0)
}

if len(prefixes) == 0 {
fmt.Println("You must provide the directory to split via the --prefix flag")
os.Exit(1)
Expand Down

0 comments on commit 260fd61

Please sign in to comment.