Abstract cmd valid args get behind the factory

This commit is contained in:
Zhenguo Niu
2017-12-15 15:20:13 +08:00
parent 8647490eae
commit c3d77eea54
9 changed files with 32 additions and 95 deletions

View File

@@ -223,3 +223,19 @@ func ValidResourceTypeList(f ClientAccessFactory) string {
`)
}
// Retrieve a list of handled resources from printer as valid args
// TODO: This function implementation should be replaced with a real implementation from the
// discovery service.
func ValidArgList(f ClientAccessFactory) []string {
validArgs := []string{}
p, err := f.Printer(nil, printers.PrintOptions{
ColumnLabels: []string{},
})
CheckErr(err)
if p != nil {
validArgs = p.HandledResources()
}
return validArgs
}