grim/hgkeeper

3c290648b1c5
Parents 6eec5741c02e
Children 192d0f174bf4
rename setup.SetupCommand to setup.Command
--- a/main.go Thu Apr 18 15:25:12 2019 -0500
+++ b/main.go Thu Apr 18 15:26:05 2019 -0500
@@ -11,9 +11,9 @@
)
type commands struct {
- ReposPath string `kong:"flag,name='repos-path',default='repos',help='the directory where the repository are stored'"`
- Serve serve.Command `kong:"cmd,help='run the ssh server'"`
- Setup setup.SetupCommand `kong:"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 serve.Command `kong:"cmd,help='run the ssh server'"`
+ Setup setup.Command `kong:"cmd,help='inital setup for the server'"`
}
func init() {
--- a/setup/command.go Thu Apr 18 15:25:12 2019 -0500
+++ b/setup/command.go Thu Apr 18 15:26:05 2019 -0500
@@ -8,7 +8,7 @@
"bitbucket.org/rw_grim/hgkeeper/hg"
)
-type SetupCommand struct {
+type Command struct {
AdminRepo string `kong:"flag,name='admin-repo',default='hgkeeper',help='the name of the admin repo to create'"`
adminRepoPath string
}
@@ -27,7 +27,7 @@
`
)
-func (c *SetupCommand) Run(reposPath string) error {
+func (c *Command) Run(reposPath string) error {
c.adminRepoPath = filepath.Join(reposPath, c.AdminRepo)
funcs := []setupFunc{
@@ -45,7 +45,7 @@
return nil
}
-func (c *SetupCommand) createReposDir(reposPath string) error {
+func (c *Command) createReposDir(reposPath string) error {
if _, err := os.Stat(reposPath); os.IsNotExist(err) {
err := os.MkdirAll(reposPath, 0755)
if err != nil {
@@ -56,7 +56,7 @@
return nil
}
-func (c *SetupCommand) createAdminRepo(reposPath string) error {
+func (c *Command) createAdminRepo(reposPath string) error {
repo, err := hg.NewRepository(c.adminRepoPath)
if err != nil {
return err