Read issue/PR description from stdin or a file (#1096)

Closes #1095.

`tea issues create` and `tea pulls create` now resolve the description in the same way as comments: when stdin is piped and neither `--description` nor `--description-file` is given, the body is read from stdin. Both create and edit commands also accept:

```text
--description-file <path>   # '-' reads stdin
```

This avoids the PowerShell 5.1 argument mangling and ANSI code page issues described in #1095.

## Changes

- Add `--description-file` to `issues create`, `issues edit`, `pulls create`, and `pulls edit`.
- Create commands fall back to piped stdin when no description flag is set.
- Add unit tests for the new body resolution.

---------

Co-authored-by: bircni <bircni@icloud.com>
Reviewed-on: https://gitea.com/gitea/tea/pulls/1096
Reviewed-by: bircni <bircni@icloud.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao
2026-08-23 12:46:22 +00:00
committed by bircni
parent dfe89dfb6b
commit bfda25be63
4 changed files with 270 additions and 5 deletions
+8
View File
@@ -221,6 +221,8 @@ Create an issue on repository
**--description, -d**="":
**--description-file**="": Read description from file ('-' for stdin)
**--labels, -L**="": Comma-separated list of labels to assign
**--login, -l**="": Use a different Gitea Login. Optional
@@ -247,6 +249,8 @@ Edit one or more issues
**--description, -d**="":
**--description-file**="": Read description from file ('-' for stdin)
**--login, -l**="": Use a different Gitea Login. Optional
**--milestone, -m**="": Milestone to assign
@@ -379,6 +383,8 @@ Create a pull-request
**--description, -d**="":
**--description-file**="": Read description from file ('-' for stdin)
**--draft**: Create as a draft (prepends "WIP: " to the title; Gitea treats WIP-prefixed PRs as drafts)
**--head**="": Branch name of the PR source (default is current one). To specify a different head repo, use <user>:<branch>
@@ -437,6 +443,8 @@ Edit one or more pull requests
**--description, -d**="":
**--description-file**="": Read description from file ('-' for stdin)
**--draft**: Mark as draft by prepending "WIP: " to the title (idempotent)
**--login, -l**="": Use a different Gitea Login. Optional