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
|
||||
|
||||
|
|
18
vvin.go
18
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 (
|
||||
|
|
Loading…
Reference in a new issue