feat: add --version flag
This commit is contained in:
parent
f0cd4bcb68
commit
8a300ad8ed
1 changed files with 4 additions and 0 deletions
4
main.go
4
main.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue