add print version

This commit is contained in:
raziman 2020-07-21 20:51:10 +08:00
parent 911cd17321
commit 377ee6ac48

View File

@ -4,6 +4,7 @@ package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
@ -14,6 +15,10 @@ import (
"github.com/ztrue/tracerr"
)
const VERSION = "v1.3.1"
var gomu *Gomu
// created so we can keep track of childrens in slices
type Panel interface {
HasFocus() bool
@ -122,11 +127,13 @@ func (g *Gomu) SetUnfocusPanel(panel Panel) {
g.PrevPanel.SetTitleColor((g.TextColor))
}
// one single instance of global variable
var gomu *Gomu
func start(application *tview.Application, args Args) {
if *args.version {
fmt.Printf("Gomu %s\n", VERSION)
return
}
// override default border
// change double line border to one line border when focused
tview.Borders.HorizontalFocus = tview.Borders.Horizontal
@ -301,6 +308,7 @@ type Args struct {
config *string
load *bool
music *string
version *bool
}
func getArgs() Args {
@ -309,6 +317,7 @@ func getArgs() Args {
config: flag.String("config", "~/.config/gomu/config", "specify config file"),
load: flag.Bool("load", true, "load previous queue"),
music: flag.String("music", "~/music", "specify music directory"),
version: flag.Bool("version", false, "print gomu version"),
}
flag.Parse()