From 5db4bcd524bb1511ae45f49a76666a1e48191e0e Mon Sep 17 00:00:00 2001 From: Will Maier Date: Sun, 18 Oct 2015 17:48:34 +0000 Subject: [PATCH] Print version --- 1pwsafe.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/1pwsafe.go b/1pwsafe.go index 5f1f826..0f378a4 100644 --- a/1pwsafe.go +++ b/1pwsafe.go @@ -3,6 +3,8 @@ package main import ( "bytes" "encoding/csv" + "flag" + "fmt" "io" "log" "os" @@ -10,7 +12,18 @@ import ( "text/template" ) +var ( + version string + fVersion = flag.Bool("v", false, "print program version") +) + func main() { + flag.Parse() + if *fVersion { + fmt.Fprintf(os.Stdout, "1pwsafe %s\n", version) + os.Exit(0) + } + w := csv.NewWriter(os.Stdout) r := csv.NewReader(os.Stdin) r.Comma = '\t'