cli: add version flag

Signed-off-by: Sunny <me@darkowlzz.space>
This commit is contained in:
Sunny 2017-09-30 19:18:00 +05:30
parent ded6d367fe
commit e889283017

View File

@ -25,8 +25,14 @@ func main() {
flag.Usage = usage
breakdownFlag := flag.Bool("breakdown", false, "")
jsonFlag := flag.Bool("json", false, "")
showVersion := flag.Bool("version", false, "Show the enry version information")
flag.Parse()
if *showVersion {
fmt.Println(version)
return
}
root, err := filepath.Abs(flag.Arg(0))
if err != nil {
log.Fatal(err)
@ -129,6 +135,7 @@ func usage() {
usage: %[1]s <path>
%[1]s [-json] [-breakdown] <path>
%[1]s [-json] [-breakdown]
%[1]s [-version]
`,
os.Args[0], version, build, commit, data.LinguistCommit[:7],
)