grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
overhaul how commands are found/run
2019-07-23, Gary Kramlich
eb233ca9b428
overhaul how commands are found/run
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
}
func
NewInit
(
reposPath
,
repoName
string
)
*
Init
{
return
&
Init
{
repoPath
:
filepath
.
Join
(
reposPath
,
repoName
),
repoName
:
repoName
,
}
}
func
(
i
*
Init
)
Run
(
conn
ssh
.
Channel
,
serverConn
*
ssh
.
ServerConn
,
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
)
}