feat(packages): add delete command

Description

Adds glab packages delete (alias rm): deletes a package by numeric ID, with a confirmation prompt that can be skipped with -y for scripts.

Related to #7421 (closed)

How has this been tested?

Automated:

  • go test ./internal/commands/packages/delete/...
  • golangci-lint run ./internal/commands/packages/... — 0 issues

Manual (using a package created in !3394 (merged)):

  1. Build the branch: make build
  2. ./bin/glab packages list -R group/project --jq '.[] | "\(.id) \(.name) \(.version)"' — find the numeric ID of a package to delete.
  3. ./bin/glab packages delete <id> -R group/project — prompts for confirmation; answering no cancels without deleting.
  4. Run it again and confirm — the package is deleted; glab packages list no longer shows it.
  5. ./bin/glab packages rm <id> -y -R group/project — the rm alias with -y deletes without prompting.
  6. ./bin/glab packages delete not-a-number -R group/project — fails with "package ID must be an integer".
  7. ./bin/glab packages delete <id> -R group/project < /dev/null — non-interactive without -y fails asking for the -y flag.
Edited by Oscar Tovar

Merge request reports

Loading