grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Remove the mercurial 6.1 pin from the container image
23 months ago, Gary Kramlich
653b933ba715
Remove the mercurial 6.1 pin from the container image
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
)
}
}