grim/hgkeeper

7dd7f9cf8e7b
rework the ssh keyloading to *NOT* be a method
package commands
import (
"golang.org/x/crypto/ssh"
"path/filepath"
"bitbucket.org/rw_grim/hgkeeper/access"
"bitbucket.org/rw_grim/hgkeeper/hg"
)
type Init struct {
repoPath string
repoName string
access *access.Access
}
func NewInit(reposPath, repoName string, access *access.Access) *Init {
return &Init{
repoPath: filepath.Join(reposPath, repoName),
repoName: repoName,
access: access,
}
}
func (i *Init) Run(conn ssh.Channel, serverConn *ssh.ServerConn, username string, req *ssh.Request) error {
return run(hg.Init(i.repoPath), conn, serverConn, req)
}
func (i *Init) CheckAccess(access *access.Access, username string) bool {
return access.Global.CanInit(username)
}
func (i *Init) String() string {
return "hg init"
}