cli: Lookup subcommand names dynamically

This lets us get the chosen subcommands dynamically and removes the
eventual need for three package imports.
This commit is contained in:
James Shubin
2024-03-03 15:48:23 -05:00
parent a65c87b584
commit d537c3d523
3 changed files with 64 additions and 6 deletions

View File

@@ -68,15 +68,15 @@ func (obj *DeployArgs) Run(ctx context.Context, data *cliUtil.Data) (bool, error
var name string
var args interface{}
if cmd := obj.DeployEmpty; cmd != nil {
name = emptyGAPI.Name
name = cliUtil.LookupSubcommand(obj, cmd) // "empty"
args = cmd
}
if cmd := obj.DeployLang; cmd != nil {
name = langGAPI.Name
name = cliUtil.LookupSubcommand(obj, cmd) // "lang"
args = cmd
}
if cmd := obj.DeployYaml; cmd != nil {
name = yamlGAPI.Name
name = cliUtil.LookupSubcommand(obj, cmd) // "yaml"
args = cmd
}