@@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"bufio"
5
5
"flag"
6
+ "fmt"
6
7
"io"
7
8
"os"
8
9
"strings"
@@ -14,6 +15,8 @@ import (
14
15
var (
15
16
fdebug bool
16
17
githook string
18
+ showVersion bool
19
+ Version string = "Development Build"
17
20
)
18
21
19
22
const (
@@ -34,9 +37,16 @@ type Options struct {
34
37
func main () {
35
38
flag .BoolVar (& fdebug , "debug" , false , "enable debug mode (warning: very verbose)" )
36
39
flag .BoolVar (& fdebug , "d" , false , "short form of debug (warning: very verbose)" )
40
+ flag .BoolVar (& showVersion , "v" , false , "show current version of talisman" )
41
+ flag .BoolVar (& showVersion , "version" , false , "show current version of talisman" )
37
42
flag .StringVar (& githook , "githook" , PrePush , "either pre-push or pre-commit" )
38
43
flag .Parse ()
39
44
45
+ if showVersion {
46
+ fmt .Printf ("talisman %s\n " , Version )
47
+ os .Exit (0 )
48
+ }
49
+
40
50
options := Options {
41
51
debug : fdebug ,
42
52
githook : githook ,
@@ -56,7 +66,7 @@ func run(stdin io.Reader, options Options) (returnCode int) {
56
66
options .githook = PrePush
57
67
}
58
68
59
- log .Info ("Running %s hook" , options .githook )
69
+ log .Infof ("Running %s hook" , options .githook )
60
70
61
71
var additions []git_repo.Addition
62
72
if options .githook == PreCommit {
0 commit comments