grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
ignore the build binaries
23 months ago, Gary Kramlich
ef4ae04808d3
ignore the build binaries
package
commands
import
(
"fmt"
"github.com/gliderlabs/ssh"
"keep.imfreedom.org/grim/hgkeeper/hg"
)
type
Command
interface
{
Run
(
session
ssh
.
Session
,
username
string
)
error
}
func
Find
(
cmd
,
reposPath
string
)
(
Command
,
error
)
{
pcmd
,
values
,
err
:=
hg
.
ParseCommandArguments
(
cmd
)
if
err
!=
nil
{
return
nil
,
err
}
switch
pcmd
{
case
"hg serve"
:
return
NewServe
(
reposPath
,
values
.
Hg
.
Repo
),
nil
case
"hg init <repo>"
:
return
NewInit
(
reposPath
,
values
.
Hg
.
Init
.
Repo
),
nil
default
:
return
nil
,
fmt
.
Errorf
(
"unknown command %s"
,
cmd
)
}
}