main: expose the version with a flag

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-08-16 11:37:11 -04:00
parent 475c51cbd7
commit 92b6fc1af3

View file

@ -26,6 +26,7 @@ var (
flBsdKeywords = flag.Bool("bsd-keywords", false, "only operate on keywords that are supported by upstream mtree(8)")
flListUsedKeywords = flag.Bool("list-used", false, "list all the keywords found in a validation manifest")
flDebug = flag.Bool("debug", false, "output debug info to STDERR")
flVersion = flag.Bool("version", false, "display the version of this tool")
)
var formats = map[string]func(*mtree.Result) string{
@ -72,6 +73,11 @@ func main() {
}
}()
if *flVersion {
fmt.Printf("%s :: %s\n", os.Args[0], mtree.Version)
return
}
// -list-keywords
if *flListKeywords {
fmt.Println("Available keywords:")