Skip to content

Commit 260fd61

Browse files
committed
added --version flag
1 parent 3fb2ea2 commit 260fd61

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

main.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import (
1010
"github.com/splitsh/lite/splitter"
1111
)
1212

13+
var (
14+
version = "dev"
15+
)
16+
1317
type prefixesFlag []*splitter.Prefix
1418

1519
func (p *prefixesFlag) String() string {
@@ -38,7 +42,7 @@ func (p *prefixesFlag) Set(value string) error {
3842

3943
var prefixes prefixesFlag
4044
var origin, target, commit, path, gitVersion string
41-
var scratch, debug, quiet, legacy, progress bool
45+
var scratch, debug, quiet, legacy, progress, v bool
4246

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

5762
func main() {
5863
flag.Parse()
5964

65+
if v {
66+
fmt.Printf("splitsh-lite version %s\n", version)
67+
os.Exit(0)
68+
}
69+
6070
if len(prefixes) == 0 {
6171
fmt.Println("You must provide the directory to split via the --prefix flag")
6272
os.Exit(1)

0 commit comments

Comments
 (0)