grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Remove the mercurial 6.1 pin from the container image
22 months ago, Gary Kramlich
653b933ba715
Remove the mercurial 6.1 pin from the container image
package
hg
import
(
"github.com/alecthomas/kong"
"github.com/kballard/go-shellquote"
)
type
CommandArguments
struct
{
Hg
struct
{
Repo
string
`kong:"flag,short='R'"`
Serve
struct
{
Stdio
bool
`kong:"flag,name='stdio'"`
}
`kong:"cmd"`
Init
struct
{
Repo
string
`kong:"arg"`
}
`kong:"cmd"`
}
`kong:"cmd"`
}
func
ParseCommandArguments
(
cmd
string
)
(
string
,
CommandArguments
,
error
)
{
values
:=
CommandArguments
{}
args
,
err
:=
shellquote
.
Split
(
cmd
)
if
err
!=
nil
{
return
""
,
values
,
err
}
parser
:=
kong
.
Must
(
&
values
)
ctx
,
err
:=
parser
.
Parse
(
args
)
if
err
!=
nil
{
return
""
,
values
,
err
}
return
ctx
.
Command
(),
values
,
nil
}