fix: dont panic on missing flags

This commit is contained in:
Julian Sommer
2026-08-19 14:37:07 +10:00
parent dede6c1158
commit 28330cb318
3 changed files with 6 additions and 18 deletions
+2 -6
View File
@@ -415,15 +415,11 @@ func init() {
imagesRemoveCmd.Flags().String("image-id", "", "AMI ID to remove (required)")
imagesRemoveCmd.Flags().Bool("force", false, "Bypass dependency, ownership and config-corrupt checks (salvage mode)")
imagesRemoveCmd.Flags().Bool("yes", false, "Skip interactive confirmation prompt")
if err := imagesRemoveCmd.MarkFlagRequired("image-id"); err != nil {
panic(err)
}
_ = imagesRemoveCmd.MarkFlagRequired("image-id")
imagesPromoteCmd.Flags().String("image-id", "", "AMI ID to promote to system image (required)")
imagesPromoteCmd.Flags().Bool("yes", false, "Skip interactive confirmation prompt")
if err := imagesPromoteCmd.MarkFlagRequired("image-id"); err != nil {
panic(err)
}
_ = imagesPromoteCmd.MarkFlagRequired("image-id")
}
const bytesPerGiB = 1024 * 1024 * 1024
+2 -6
View File
@@ -60,16 +60,12 @@ func init() {
certCreateTenantCACmd.Flags().StringSlice("domain", nil, "Domain the tenant CA is permitted to sign for (repeatable)")
certCreateTenantCACmd.Flags().Bool("regenerate", false, "Replace an existing tenant CA with a fresh root (invalidates every device's trust store — requires confirmation)")
certCreateTenantCACmd.Flags().Bool("yes", false, "Skip the --regenerate confirmation prompt")
if err := certCreateTenantCACmd.MarkFlagRequired("domain"); err != nil {
panic(err)
}
_ = certCreateTenantCACmd.MarkFlagRequired("domain")
certCmd.AddCommand(certForceRenewCmd)
certForceRenewCmd.Flags().String("arn", "", "Certificate ARN to force-renew (required)")
certForceRenewCmd.Flags().String("account", "", "Account ID that owns the certificate; defaults to the bootstrap account")
if err := certForceRenewCmd.MarkFlagRequired("arn"); err != nil {
panic(err)
}
_ = certForceRenewCmd.MarkFlagRequired("arn")
}
func runCertForceRenew(cmd *cobra.Command, _ []string) {
+2 -6
View File
@@ -1138,15 +1138,11 @@ func init() {
c.Flags().String("account-id", "", "12-digit account ID to change (required)")
c.Flags().String("model-id", "", "Model ID to change (e.g. meta.llama3-2-1b-instruct-v1:0)")
c.Flags().Bool("all-models", false, "Apply to every model in the platform catalog")
if err := c.MarkFlagRequired("account-id"); err != nil {
panic(err)
}
_ = c.MarkFlagRequired("account-id")
}
adminOchreAccessListCmd.Flags().String("account-id", "", "12-digit account ID to inspect (required)")
if err := adminOchreAccessListCmd.MarkFlagRequired("account-id"); err != nil {
panic(err)
}
_ = adminOchreAccessListCmd.MarkFlagRequired("account-id")
}
// ochreAccessStore connects to the cluster and returns the grant store along