feat: add --version flag

This commit is contained in:
yory8 2019-10-02 16:20:04 +02:00
parent f0cd4bcb68
commit 8a300ad8ed

View file

@ -13,6 +13,8 @@ import (
"gopkg.in/alecthomas/kingpin.v2" "gopkg.in/alecthomas/kingpin.v2"
) )
const version = "1.0.2"
var ( var (
app = kingpin.New("clipman", "A clipboard manager for Wayland") app = kingpin.New("clipman", "A clipboard manager for Wayland")
histpath = app.Flag("histpath", "Path of history file").Default("~/.local/share/clipman.json").String() histpath = app.Flag("histpath", "Path of history file").Default("~/.local/share/clipman.json").String()
@ -32,7 +34,9 @@ var (
) )
func main() { func main() {
app.Version(version)
app.HelpFlag.Short('h') app.HelpFlag.Short('h')
app.VersionFlag.Short('v')
switch kingpin.MustParse(app.Parse(os.Args[1:])) { switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case "store": case "store":
histfile, history, err := getHistory(*histpath) histfile, history, err := getHistory(*histpath)