mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-30 02:28:48 -04:00
cli: show instance types on help and usage
This commit is contained in:
parent
c63d7126e7
commit
69d0ecd26d
3 changed files with 22 additions and 2 deletions
|
@ -32,7 +32,7 @@ func isCloudProvider(arg int) cobra.PositionalArgs {
|
|||
}
|
||||
}
|
||||
|
||||
func validInstanceTypeForProvider(insType string, provider cloudprovider.Provider) error {
|
||||
func validInstanceTypeForProvider(cmd *cobra.Command, insType string, provider cloudprovider.Provider) error {
|
||||
switch provider {
|
||||
case cloudprovider.GCP:
|
||||
for _, instanceType := range gcp.InstanceTypes {
|
||||
|
@ -40,6 +40,8 @@ func validInstanceTypeForProvider(insType string, provider cloudprovider.Provide
|
|||
return nil
|
||||
}
|
||||
}
|
||||
cmd.SetUsageTemplate("GCP instance types:\n" + formatInstanceTypes(gcp.InstanceTypes))
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("%s isn't a valid GCP instance type", insType)
|
||||
case cloudprovider.Azure:
|
||||
for _, instanceType := range azure.InstanceTypes {
|
||||
|
@ -47,6 +49,8 @@ func validInstanceTypeForProvider(insType string, provider cloudprovider.Provide
|
|||
return nil
|
||||
}
|
||||
}
|
||||
cmd.SetUsageTemplate("Azure instance types:\n" + formatInstanceTypes(azure.InstanceTypes))
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("%s isn't a valid Azure instance type", insType)
|
||||
default:
|
||||
return fmt.Errorf("%s isn't a valid cloud platform", provider)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue