grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Remove the explicit write access of admins to the hgkeeper repo.
23 months ago, Gary Kramlich
5389b17b4002
Remove the explicit write access of admins to the hgkeeper repo.
Fixes HGKEEPER-21
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
}