grim/hgkeeper

all: use standard Go reflect.StructTag format.
styling
2019-04-17, Wagner Riffel
028c0cc77dd3
Parents 75658f1546d3
Children 67ae6391ddc0
all: use standard Go reflect.StructTag format.
Mainly because go vet marks this as "suspicious construct", refs:
https://golang.org/pkg/reflect/#StructTag
https://golang.org/cmd/vet
--- a/hg/commands.go Wed Apr 17 18:04:18 2019 -0500
+++ b/hg/commands.go Wed Apr 17 23:52:17 2019 -0300
@@ -9,14 +9,14 @@
type cli struct {
Hg struct {
- Repo string `flag short:"R"`
+ Repo string `kong:"flag,short='R'"`
Serve struct {
- Stdio bool `flag name:"stdio"`
- } `cmd`
+ Stdio bool `kong:"flag,name='stdio'"`
+ } `kong:"cmd"`
Init struct {
- Repo string `arg`
- } `cmd`
- } `cmd`
+ Repo string `kong:"arg"`
+ } `kong:"cmd"`
+ } `kong:"cmd"`
}
func RepoFromCommand(cmd string) (*Repository, error) {
--- a/main.go Wed Apr 17 18:04:18 2019 -0500
+++ b/main.go Wed Apr 17 23:52:17 2019 -0300
@@ -11,9 +11,9 @@
)
type commands struct {
- ReposPath string `flag name:"repos-path" default:"repos" help:"the directory where the repository are stored"`
- Serve ssh.ServeCommand `cmd help:"run the ssh server"`
- Setup setup.SetupCommand `cmd help:"inital setup for the server"`
+ ReposPath string `kong:"flag,name='repos-path',default='repos',help='the directory where the repository are stored'"`
+ Serve ssh.ServeCommand `kong:"cmd,help='run the ssh server'"`
+ Setup setup.SetupCommand `kong:"cmd,help='inital setup for the server'"`
}
func init() {
--- a/setup/command.go Wed Apr 17 18:04:18 2019 -0500
+++ b/setup/command.go Wed Apr 17 23:52:17 2019 -0300
@@ -9,7 +9,7 @@
)
type SetupCommand struct {
- AdminRepo string `flag name:"admin-repo" default:"hgkeeper" help:"the name of the admin repo to create"`
+ AdminRepo string `kong:"flag,name='admin-repo',default='hgkeeper',help='the name of the admin repo to create'"`
adminRepoPath string
}
--- a/ssh/command.go Wed Apr 17 18:04:18 2019 -0500
+++ b/ssh/command.go Wed Apr 17 23:52:17 2019 -0300
@@ -1,8 +1,8 @@
package ssh
type ServeCommand struct {
- Addr string `flag name:"listen-addr" short:"l" help:"what address to listen on" default:":22222"`
- HostKeysPath string `flag name:"host-keys-path" short:"-H" help:"the path where host keys are kept" default:"host-keys"`
+ Addr string `kong:"flag,name='listen-addr',short='l',help='what address to listen on',default=':22222'"`
+ HostKeysPath string `kong:"flag,name='host-keys-path',short='H',help='the path where host keys are kept',default='host-keys'"`
}
func (c *ServeCommand) Run(reposPath string) error {