all: Switch the --lang syntax to use argv instead

It was a bit awkward using `mgmt run lang --lang <input>` so instead, we
now drop the --lang, and read the positional argv for the input.

This also does the same for the --yaml frontend.
This commit is contained in:
James Shubin
2019-05-05 10:37:53 -04:00
parent b3632584c3
commit 43839d1090
42 changed files with 91 additions and 78 deletions

View File

@@ -70,11 +70,6 @@ func (obj *GAPI) CliFlags(command string) []cli.Flag {
fallthrough
case gapi.CommandDeploy:
return []cli.Flag{
cli.StringFlag{
Name: "puppet, p",
Value: "",
Usage: "load graph from puppet, optionally takes a manifest or path to manifest file",
},
cli.StringFlag{
Name: "puppet-conf",
Value: "",
@@ -99,10 +94,13 @@ func (obj *GAPI) Cli(cliInfo *gapi.CliInfo) (*gapi.Deploy, error) {
// cliInfo.Logf(Name + ": "+format, v...)
//}
if !c.IsSet(Name) {
return nil, nil // we weren't activated!
if l := c.NArg(); l != 1 {
if l > 1 {
return nil, fmt.Errorf("input program must be a single arg")
}
return nil, fmt.Errorf("must specify input program")
}
s := c.String(Name)
s := c.Args().Get(0)
if s == "" {
return nil, fmt.Errorf("%s input is empty", Name)
}