grim/hgkeeper

Merged in styling (pull request #1)

2019-04-18, Gary Kramlich
3e9cbb6dc6b9
Merged in styling (pull request #1)

Styling

Approved-by: Gary Kramlich
--- a/hg/commands.go Wed Apr 17 18:04:18 2019 -0500
+++ b/hg/commands.go Thu Apr 18 17:57:15 2019 +0000
@@ -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 Thu Apr 18 17:57:15 2019 +0000
@@ -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 Thu Apr 18 17:57:15 2019 +0000
@@ -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
}
@@ -67,7 +67,7 @@
return err
}
- hgrc_path := filepath.Join(c.adminRepoPath, ".hg", "hgrc")
+ hgrcPath := filepath.Join(c.adminRepoPath, ".hg", "hgrc")
- return ioutil.WriteFile(hgrc_path, []byte(hgrc), 0644)
+ return ioutil.WriteFile(hgrcPath, []byte(hgrc), 0644)
}
--- a/ssh/command.go Wed Apr 17 18:04:18 2019 -0500
+++ b/ssh/command.go Thu Apr 18 17:57:15 2019 +0000
@@ -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 {
--- a/ssh/server.go Wed Apr 17 18:04:18 2019 -0500
+++ b/ssh/server.go Thu Apr 18 17:57:15 2019 +0000
@@ -51,8 +51,6 @@
go s.processSSHChannels(chans)
}
-
- return nil
}
func (s *Server) publicKeyCallback(meta ssh.ConnMetadata, key ssh.PublicKey) (*ssh.Permissions, error) {