1
0
Fork 0
mirror of https://gitea.com/gitea/tea.git synced 2026-01-29 18:25:19 +01:00
tea/cmd
Alain Thiffault 7ab3366220 fix(labels): improve delete command and fix --id flag type (#865)
## Summary

Fix the `tea labels delete` and `tea labels update` commands which were silently ignoring the `--id` flag.

## Problem

Both commands used `IntFlag` for the `--id` parameter but called `ctx.Int64("id")` to retrieve the value. This type mismatch caused the ID to always be read as `0`, making the commands useless.

**Before (bug):**
```bash
$ tea labels delete --id 36 --debug
DELETE: .../labels/0   # Wrong! ID ignored
```

**After (fix):**
```bash
$ tea labels delete --id 36 --debug
GET: .../labels/36     # Verify exists
DELETE: .../labels/36  # Correct ID
Label 'my-label' (id: 36) deleted successfully
```

## Changes

### labels/delete.go
- Change `IntFlag` to `Int64Flag` to match `ctx.Int64()` usage
- Make `--id` flag required
- Verify label exists before attempting deletion
- Provide clear error messages with label name and ID context
- Print success message after deletion

### labels/update.go
- Change `IntFlag` to `Int64Flag` to fix the same bug

## Test plan

- [x] `go test ./...` passes
- [x] `go vet ./...` passes
- [x] `gofmt` check passes
- [x] Manual testing confirms ID is now correctly passed to API
- [ ] CI passes

Reviewed-on: https://gitea.com/gitea/tea/pulls/865
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alain Thiffault <athiffau@effectivemomentum.com>
Co-committed-by: Alain Thiffault <athiffau@effectivemomentum.com>
2026-01-25 23:36:42 +00:00
..
actions fix: expose pagination flags for secrets list command (#853) 2025-12-05 06:14:41 +00:00
admin/users Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
attachments Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
branches Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
flags Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
issues Upgrade dependencies (#849) 2025-11-24 19:21:55 +00:00
labels fix(labels): improve delete command and fix --id flag type (#865) 2026-01-25 23:36:42 +00:00
login Use bubbletea instead of survey for interacting with TUI (#786) 2025-08-11 18:23:52 +00:00
milestones Upgrade dependencies (#849) 2025-11-24 19:21:55 +00:00
notifications Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
organizations Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
pulls fix: pass pagination options to ListRepoPullRequests (#851) 2025-12-05 06:14:01 +00:00
releases Remove pagination from context (#807) 2025-08-26 23:13:27 +00:00
repos Fix delete repo description (#858) 2025-12-05 06:11:38 +00:00
times migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
webhooks fix: expose pagination flags for webhooks list command (#852) 2025-12-05 06:14:34 +00:00
actions.go feat: add actions management commands (#796) 2025-10-19 02:53:17 +00:00
admin.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
attachments.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
branches.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
categories.go spdx (#581) 2023-09-08 01:40:02 +00:00
clone.go add debug mode and update readme (#805) 2025-09-10 19:10:02 +00:00
cmd.go feat: add repository webhook management (#798) 2025-10-19 03:40:23 +00:00
comment.go Use bubbletea instead of survey for interacting with TUI (#786) 2025-08-11 18:23:52 +00:00
issues.go feat(issue): Add JSON output and file redirection (#841) 2025-11-29 05:05:30 +00:00
issues_test.go feat(issue): Add JSON output and file redirection (#841) 2025-11-29 05:05:30 +00:00
labels.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
login.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
logout.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
man.go generate man page (#811) 2025-09-14 00:17:28 +00:00
milestones.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
notifications.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
open.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
organizations.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
pulls.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
releases.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
repos.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
times.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00
webhooks.go feat: add repository webhook management (#798) 2025-10-19 03:40:23 +00:00
whoami.go migrate tea to urfave v3 (#760) 2025-06-10 05:19:59 +00:00