Merge pull request #116 from darkowlzz/version-flag

cli: add version flag
This commit is contained in:
Alfredo Beaumont 2017-10-02 12:15:16 +02:00 committed by GitHub
commit 0e34e06c8c

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],
)