glab deploy-key delete with no arguments deletes key ID 0 and reports success

Summary

glab deploy-key delete accepts zero arguments even though it requires a key ID. With no argument it sends a delete request for key ID 0 and then prints a success message, so the user is told a key was deleted when nothing was identified.

Environment

  • OS: Windows 11 - AMD64
  • SHELL: bash
  • TERM: Windows Terminal
  • GLAB: built from main at 411aa39d (also present in v1.109.0)

Steps to reproduce

glab deploy-key delete

Run it with GLAB_DEBUG=true to see the request that goes out.

What is the current bug behavior?

The command is declared with Args: cobra.MaximumNArgs(1), so the no-argument form passes validation. The missing ID falls through as the zero value and the request becomes:

DELETE /projects/:id/deploy_keys/0

The command then reports success regardless.

What is the expected correct behavior?

The command should reject the no-argument form with a usage error. Its own Use, Long and Example all show <key-id> as required, so cobra.ExactArgs(1) matches the documented contract.

Possible fixes

Change MaximumNArgs(1) to ExactArgs(1) on the delete command.