From cabde87f9a122e467886666eae72a010a4bc4a0e Mon Sep 17 00:00:00 2001 From: Evan <17254809+bigun27@users.noreply.github.com> Date: Sat, 14 Oct 2023 21:34:16 -0400 Subject: [PATCH] Make into reuseable package --- go.mod | 2 +- vvin.go | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index a5d8b18..8538334 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/shu-go/vvin +module git.bigun.dev/evan/vvin go 1.13 diff --git a/vvin.go b/vvin.go index d439f3a..aa08625 100644 --- a/vvin.go +++ b/vvin.go @@ -8,22 +8,12 @@ import ( "strconv" "strings" "syscall" - "time" "unsafe" "github.com/mitchellh/go-ps" "github.com/shu-go/gli" ) -// Version is app version -var Version string - -func init() { - if Version == "" { - Version = "dev-" + time.Now().Format("20060102") - } -} - type globalCmd struct { Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"` Debug bool `help:"output debug info"` @@ -61,17 +51,15 @@ func (c *globalCmd) Before() error { return nil } -func main() { +func Start([]string) error { app := gli.NewWith(&globalCmd{}) app.Name = "vvin" app.Desc = "Change window properties for Windows" - app.Version = Version + app.Version = "0.7.0" app.Usage = `` app.Copyright = "(C) 2019 Shuhei Kubota" app.SuppressErrorOutput = true - if err := app.Run(os.Args); err != nil { - fmt.Fprintln(os.Stderr, err) - } + return app.Run(os.Args) } var (