feat(comments): accept -d/--description for comment body (#1043)

Closes #1042.

### What

`tea issue create`, `tea issue edit` and `tea pr create` all take the body via
`-d` / `--description`, but `tea comments add` and `tea comments edit` only
accepted it positionally — passing `-d` errored with
`flag provided but not defined: -d`.

This adds `-d` / `--description` to both `comments` subcommands so every
body-bearing command shares one flag.

### Behaviour / precedence

Unchanged for existing usage. Body resolution is now:

1. positional argument (kept first for back-compat),
2. `-d` / `--description`,
3. piped stdin,
4. `$EDITOR` (interactive only).

### Testing

- `go build`, `go vet ./...`, `go test -short ./cmd/... ./modules/...` all pass.
- Manually verified `tea comments add --help` / `edit --help` list the flag,
  and that `-d` resolves the body (reaches the API, no parse error, no editor
  prompt, no stdin block).

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/1043
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Brien Coffield <coffbr01@gmail.com>
Co-committed-by: Brien Coffield <coffbr01@gmail.com>
This commit is contained in:
Brien Coffield
2026-06-29 00:52:24 +00:00
committed by Lunny Xiao
parent d4545d8ed7
commit 12947f068a
5 changed files with 171 additions and 25 deletions
+6
View File
@@ -1927,6 +1927,8 @@ Update a webhook
Manage comments on issues and pull requests
**--description, -d**="": comment body (alternative to the positional argument)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
@@ -1939,6 +1941,8 @@ Manage comments on issues and pull requests
Add a comment to an issue or pull request
**--description, -d**="": comment body (alternative to the positional argument)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
@@ -1967,6 +1971,8 @@ List comments on an issue or pull request
Edit the body of an existing comment
**--description, -d**="": new comment body (alternative to the positional argument)
**--login, -l**="": Use a different Gitea Login. Optional
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)