Updates to several commands

This commit is contained in:
rwxrob 2022-03-30 09:23:08 -04:00
parent 509f328430
commit 1d6f931e8a
No known key found for this signature in database
GPG Key ID: 2B9111F33082AE77
5 changed files with 70 additions and 5 deletions

43
go.go Normal file
View File

@ -0,0 +1,43 @@
package main
import (
"log"
"os"
Z "github.com/rwxrob/bonzai"
"github.com/rwxrob/bonzai/inc/help"
"github.com/rwxrob/fs/file"
)
var golang = &Z.Cmd{
Name: `go`,
Summary: `go related helper actions`,
MinArgs: 1,
Commands: []*Z.Cmd{help.Cmd, gowork},
}
var gowork = &Z.Cmd{
Name: `work`,
Summary: `turn on or off go.work file`,
Usage: `(on|off)`,
MinArgs: 1,
Params: []string{"on", "off"},
Commands: []*Z.Cmd{help.Cmd},
Call: func(x *Z.Cmd, args ...string) error {
switch args[0] {
case "on":
if file.Exists("go.work.off") {
log.Print("go.work.off -> go.work")
return os.Rename("go.work.off", "go.work")
}
case "off":
if file.Exists("go.work") {
log.Print("go.work -> go.work.off")
return os.Rename("go.work", "go.work.off")
}
default:
return x.UsageError()
}
return nil
},
}

8
go.mod
View File

@ -3,9 +3,10 @@ module github.com/rwxrob/z
go 1.18
require (
github.com/rwxrob/bonzai v0.0.35
github.com/rwxrob/bonzai v0.0.37
github.com/rwxrob/config v0.3.1
github.com/rwxrob/twitch v0.2.0
github.com/rwxrob/fs v0.4.3
github.com/rwxrob/twitch v0.2.2
github.com/rwxrob/y2j v0.3.1
github.com/rwxrob/yq v0.2.0
)
@ -22,7 +23,6 @@ require (
github.com/mikefarah/yq/v4 v4.24.2 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/rwxrob/fn v0.3.0 // indirect
github.com/rwxrob/fs v0.4.2 // indirect
github.com/rwxrob/json v0.4.1 // indirect
github.com/rwxrob/structs v0.5.0 // indirect
github.com/rwxrob/term v0.1.4 // indirect
@ -32,7 +32,7 @@ require (
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
golang.org/x/sys v0.0.0-20220329152356-43be30ef3008 // indirect
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect

12
go.sum
View File

@ -43,6 +43,10 @@ github.com/rwxrob/bonzai v0.0.34 h1:3zY+IWT6PmHtoSI5d2RPMzArvRlklBqJkRjkh7sDsIQ=
github.com/rwxrob/bonzai v0.0.34/go.mod h1:PyKG44H68o3DZ2Xh6ouViGW9IAbYZVw0OYqLMdCM1RI=
github.com/rwxrob/bonzai v0.0.35 h1:lusloBXsayqts9a5LkC7TFcjOwHhpNzIbd9zqjCYUsk=
github.com/rwxrob/bonzai v0.0.35/go.mod h1:PyKG44H68o3DZ2Xh6ouViGW9IAbYZVw0OYqLMdCM1RI=
github.com/rwxrob/bonzai v0.0.36 h1:+DW6cnxM9deUBA3gj04iyM4UP3HoRduiwHFNBPPjmCA=
github.com/rwxrob/bonzai v0.0.36/go.mod h1:PyKG44H68o3DZ2Xh6ouViGW9IAbYZVw0OYqLMdCM1RI=
github.com/rwxrob/bonzai v0.0.37 h1:fRycoZEaJQIp6EfK3//97e+T2gOIWdyzOxhLeKhUc8Q=
github.com/rwxrob/bonzai v0.0.37/go.mod h1:PyKG44H68o3DZ2Xh6ouViGW9IAbYZVw0OYqLMdCM1RI=
github.com/rwxrob/config v0.2.1 h1:W53hExSNj2PtRRTuRXklruzVuOZ9LB8SDo9MC0qRiXQ=
github.com/rwxrob/config v0.2.1/go.mod h1:I2Diy79ZQPlanERtvt4VCSvW3jyCHeJ0JXksJMAz8xY=
github.com/rwxrob/config v0.3.0 h1:s6YQ82+lTKzi/YZRN0PmHOGf8GQXGtGy1ZwOzcfsmyk=
@ -61,6 +65,8 @@ github.com/rwxrob/fs v0.4.1 h1:u7dd7RLm0ozu62UAu+emjmQPdpztAv0VkzhUiQPEGCs=
github.com/rwxrob/fs v0.4.1/go.mod h1:vO8AeluD7rnrO7zC54745xTEBFgHPUpHL0hbp1NnsVo=
github.com/rwxrob/fs v0.4.2 h1:KXBs48us7rwkIAT05IMpKJ2AQNHLGBqHaqaCpXjrys0=
github.com/rwxrob/fs v0.4.2/go.mod h1:vO8AeluD7rnrO7zC54745xTEBFgHPUpHL0hbp1NnsVo=
github.com/rwxrob/fs v0.4.3 h1:ntu9TZnk7NHd1Yen+p4+xruBmkQMugKtFU0OLfAMa+M=
github.com/rwxrob/fs v0.4.3/go.mod h1:vO8AeluD7rnrO7zC54745xTEBFgHPUpHL0hbp1NnsVo=
github.com/rwxrob/json v0.4.1 h1:b4ToZe4mrQO8rRL/kRFglzZszyZZnGv6JRHj6jrI3f4=
github.com/rwxrob/json v0.4.1/go.mod h1:DU3TQKCWY4bK7sQ0wu80cRmTs96b6M//OYvT7Eg2mJA=
github.com/rwxrob/structs v0.5.0 h1:pjLsfyYHS+gB1CtzRj3H39wRYL4lI5pTpFf8kl91guw=
@ -79,6 +85,10 @@ github.com/rwxrob/twitch v0.1.1 h1:FdPD7brFnBoKYy3YKY7NBe7AhhCn3c/S55dyjIB3LYY=
github.com/rwxrob/twitch v0.1.1/go.mod h1:aqAne9uW0iuy/fJfuuZdrGMINt6dX/EyrywzH4IvSpU=
github.com/rwxrob/twitch v0.2.0 h1:xxwQxHbF0j+Vhvz/BjI13s0aORcAth4KuEhCKVnihMo=
github.com/rwxrob/twitch v0.2.0/go.mod h1:aqAne9uW0iuy/fJfuuZdrGMINt6dX/EyrywzH4IvSpU=
github.com/rwxrob/twitch v0.2.1 h1:kT+eic0a/QOdvs7ByhoGEC/eJBcurgu2i5+TdCU5k5g=
github.com/rwxrob/twitch v0.2.1/go.mod h1:aqAne9uW0iuy/fJfuuZdrGMINt6dX/EyrywzH4IvSpU=
github.com/rwxrob/twitch v0.2.2 h1:b0rzpu1ySejOADZTYw8hJFtyfNtklPV7xsh+SQM/UGs=
github.com/rwxrob/twitch v0.2.2/go.mod h1:aqAne9uW0iuy/fJfuuZdrGMINt6dX/EyrywzH4IvSpU=
github.com/rwxrob/y2j v0.3.0 h1:iaYmvRJVi9EMFlA0VSrLZiHXzUqDNOyTkGyjBqR4ZA0=
github.com/rwxrob/y2j v0.3.0/go.mod h1:/3eS+LPnOF1F2VfoqZr3Upkr8q4ByziAi3eB6FIgzoE=
github.com/rwxrob/y2j v0.3.1 h1:qOCU7J6g0Q/7KlLAabCMLx6/wG1/NelG6QTOVpESAQg=
@ -119,6 +129,8 @@ golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886 h1:eJv7u3ksNXoLbGSKuv2s/SIO4
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220329152356-43be30ef3008 h1:pq9pwoi2rjLWvmiVser/lIOgiyA3fli4M+RfGVMA7nE=
golang.org/x/sys v0.0.0-20220329152356-43be30ef3008/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

8
go.work.off Normal file
View File

@ -0,0 +1,8 @@
go 1.19
use (
.
../bonzai
../fs
../twitch
)

View File

@ -18,6 +18,8 @@ func main() {
"status": {"tmux", "update"},
"project": {"twitch", "bot", "commands", "edit", "project"},
"commands": {"twitch", "bot", "commands"},
"work": {"go", "work"},
"chat": {"twitch", "chat"},
}
Cmd.Run()
}
@ -29,6 +31,6 @@ var Cmd = &Z.Cmd{
Copyright: `Copyright 2021 Robert S Muhlestein`,
License: `Apache-2.0`,
Commands: []*Z.Cmd{
help.Cmd, config.Cmd, y2j.Cmd, twitch.Cmd, tmux, yq.Cmd, //edit.Cmd,
help.Cmd, config.Cmd, y2j.Cmd, twitch.Cmd, tmux, yq.Cmd, golang,
},
}