2020-08-13 11:20:22 -04:00
package common
import (
"fmt"
"github.com/hashicorp/boundary/internal/cmd/base"
2020-09-08 13:27:51 -07:00
"github.com/posener/complete"
2020-08-13 11:20:22 -04:00
)
2020-08-18 17:46:34 -04:00
func PopulateCommonFlags ( c * base . Command , f * base . FlagSet , resourceType string , flagNames [] string ) {
2020-08-13 11:20:22 -04:00
for _ , name := range flagNames {
switch name {
2020-09-08 13:27:51 -07:00
case "scope-id" :
f . StringVar ( & base . StringVar {
Name : "scope-id" ,
Target : & c . FlagScopeId ,
Default : "global" ,
Completion : complete . PredictAnything ,
2020-09-16 08:50:43 -04:00
Usage : `Scope in which to make the request.` ,
2020-09-08 13:27:51 -07:00
})
2020-08-13 11:20:22 -04:00
case "id" :
f . StringVar ( & base . StringVar {
Name : "id" ,
Target : & c . FlagId ,
2020-08-18 17:46:34 -04:00
Usage : fmt . Sprintf ( "ID of the %s on which to operate" , resourceType ),
2020-08-13 11:20:22 -04:00
})
case "name" :
f . StringVar ( & base . StringVar {
Name : "name" ,
Target : & c . FlagName ,
2020-08-18 17:46:34 -04:00
Usage : fmt . Sprintf ( "Name to set on the %s" , resourceType ),
2020-08-13 11:20:22 -04:00
})
case "description" :
f . StringVar ( & base . StringVar {
Name : "description" ,
Target : & c . FlagDescription ,
2020-08-18 17:46:34 -04:00
Usage : fmt . Sprintf ( "Description to set on the %s" , resourceType ),
2020-08-13 11:20:22 -04:00
})
case "version" :
f . IntVar ( & base . IntVar {
Name : "version" ,
Target : & c . FlagVersion ,
2020-08-18 17:46:34 -04:00
Usage : fmt . Sprintf ( "The version of the %s against which to perform an update operation. If not specified, the command will perform a check-and-set automatically." , resourceType ),
2020-08-13 11:20:22 -04:00
})
}
}
}