Make into reuseable package
This commit is contained in:
parent
4935f4ceac
commit
cabde87f9a
2 changed files with 4 additions and 16 deletions
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/shu-go/vvin
|
module git.bigun.dev/evan/vvin
|
||||||
|
|
||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
|
|
18
vvin.go
18
vvin.go
|
@ -8,22 +8,12 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/mitchellh/go-ps"
|
"github.com/mitchellh/go-ps"
|
||||||
"github.com/shu-go/gli"
|
"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 {
|
type globalCmd struct {
|
||||||
Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"`
|
Target string `cli:"target,t=WINDOW_TITLE" help:"default to current window"`
|
||||||
Debug bool `help:"output debug info"`
|
Debug bool `help:"output debug info"`
|
||||||
|
@ -61,17 +51,15 @@ func (c *globalCmd) Before() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func Start([]string) error {
|
||||||
app := gli.NewWith(&globalCmd{})
|
app := gli.NewWith(&globalCmd{})
|
||||||
app.Name = "vvin"
|
app.Name = "vvin"
|
||||||
app.Desc = "Change window properties for Windows"
|
app.Desc = "Change window properties for Windows"
|
||||||
app.Version = Version
|
app.Version = "0.7.0"
|
||||||
app.Usage = ``
|
app.Usage = ``
|
||||||
app.Copyright = "(C) 2019 Shuhei Kubota"
|
app.Copyright = "(C) 2019 Shuhei Kubota"
|
||||||
app.SuppressErrorOutput = true
|
app.SuppressErrorOutput = true
|
||||||
if err := app.Run(os.Args); err != nil {
|
return app.Run(os.Args)
|
||||||
fmt.Fprintln(os.Stderr, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in a new issue