@@ -195,23 +195,21 @@ func NewCmdSecretsRemove() *cobra.Command {
195195 )
196196
197197 cmd := & cobra.Command {
198- Use : "remove SECRET_NAME" ,
199- Short : "Remove a CI secret " ,
200- Long : `Remove a CI secret from your organization.` ,
198+ Use : "remove SECRET_NAME [SECRET_NAME...] " ,
199+ Short : "Remove one or more CI secrets " ,
200+ Long : `Remove one or more CI secrets from your organization.` ,
201201 Example : ` # Remove a secret
202202 depot ci secrets remove GITHUB_TOKEN
203203
204- # Remove a secret without confirmation prompt
205- depot ci secrets remove MY_API_KEY --force` ,
204+ # Remove multiple secrets
205+ depot ci secrets remove GITHUB_TOKEN MY_API_KEY DATABASE_URL
206+
207+ # Remove secrets without confirmation prompt
208+ depot ci secrets remove GITHUB_TOKEN MY_API_KEY --force` ,
206209 Aliases : []string {"rm" },
207- Args : cobra .ExactArgs (1 ),
210+ Args : cobra .MinimumNArgs (1 ),
208211 RunE : func (cmd * cobra.Command , args []string ) error {
209212 ctx := cmd .Context ()
210- secretName := args [0 ]
211-
212- if secretName == "" {
213- return fmt .Errorf ("secret name cannot be empty" )
214- }
215213
216214 if orgID == "" {
217215 orgID = config .GetCurrentOrganization ()
@@ -226,7 +224,8 @@ func NewCmdSecretsRemove() *cobra.Command {
226224 }
227225
228226 if ! force {
229- prompt := fmt .Sprintf ("Are you sure you want to remove CI secret '%s'? (y/N): " , secretName )
227+ names := strings .Join (args , ", " )
228+ prompt := fmt .Sprintf ("Are you sure you want to remove CI secret(s) %s? (y/N): " , names )
230229 y , err := helpers .PromptForYN (prompt )
231230 if err != nil {
232231 return fmt .Errorf ("failed to read confirmation: %w" , err )
@@ -235,12 +234,14 @@ func NewCmdSecretsRemove() *cobra.Command {
235234 }
236235 }
237236
238- err = api .CIDeleteSecret (ctx , tokenVal , orgID , secretName )
239- if err != nil {
240- return fmt .Errorf ("failed to remove secret: %w" , err )
237+ for _ , secretName := range args {
238+ err := api .CIDeleteSecret (ctx , tokenVal , orgID , secretName )
239+ if err != nil {
240+ return fmt .Errorf ("failed to remove secret '%s': %w" , secretName , err )
241+ }
242+ fmt .Printf ("Successfully removed CI secret '%s'\n " , secretName )
241243 }
242244
243- fmt .Printf ("Successfully removed CI secret '%s'\n " , secretName )
244245 return nil
245246 },
246247 }
0 commit comments