gitea.tea/modules/task
ongolk 9c12138d62
Some checks are pending
goreleaser / goreleaser (push) Waiting to run
goreleaser / release-image (push) Waiting to run
Make tea issues create honor --output json (#1114)
## Problem

Follow-up to #1111, covering the issues side of the same hole: `tea issues create` accepts `--output` (it parses through the urfave/cli v3 ancestor-flag cascade — `issues` carries the flag via `AllDefaultFlags`, `create` never declares it) but the action never reads it. Without this fix, `tea issues create --output json | jq .url` feeds jq a markdown document.

The default output is doubly hostile to consumers: glamour renders the details as markdown (with OSC 8 hyperlinks around the URL when piped), and a second bare `fmt.Println(issue.HTMLURL)` line follows it.

## What this changes

- `task.CreateIssue` now returns the created `*gitea.Issue` instead of printing it.
- `runIssuesCreate` switches on `--output`, mirroring the detail-command precedent and the merged create-PR behavior from #1111: `--output json` emits compact lean JSON; any other value (or no flag) falls through to the previous rendering, byte-identical to before.
- Lean JSON shape: `index`, `title`, `url`, `state` — matching `createdPullJSON` in `cmd/pulls/create.go`, including its post-review compact encoding.
- The interactive path is untouched — it only triggers when zero flags are set, so `--output` can never be active there.

Example:

```
$ tea issues create --output json --title "bug: thing" | jq -r .url
https://gitea.example.com/owner/repo/issues/42
```

There is no agit-flow equivalent on issues, so no extra guard is needed — unlike the pulls side, every creation path produces an `*gitea.Issue`.

---------

Co-authored-by: Danilo Sousa <code@danilosousa.net>
Reviewed-on: https://gitea.com/gitea/tea/pulls/1114
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ongolk <238961+ongolk@noreply.gitea.com>
2026-09-10 04:29:39 +00:00
..
assignees.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
issue_create.go Make tea issues create honor --output json (#1114) 2026-09-10 04:29:39 +00:00
issue_edit.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
labels.go fix(labels): add org label for ls and pr (#1017) 2026-06-24 17:46:12 +00:00
labels_export.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_create.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
login_create_test.go Skip token uniqueness check when using SSH authentication (#898) 2026-02-19 15:19:45 +00:00
login_httpsign.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_ssh.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
login_status.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
login_status_test.go feat(login): add status command (#1087) (#1105) 2026-08-28 23:55:13 +00:00
milestone_create.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_checkout.go Add reply to code review (#978) 2026-06-26 21:40:31 +00:00
pull_clean.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_create.go Make tea pulls create honor --output json (#1111) 2026-09-08 19:20:40 +00:00
pull_create_test.go spdx (#581) 2023-09-08 01:40:02 +00:00
pull_edit.go feat(assignees): add set, add, and remove assignees APIs (#1045) 2026-07-18 00:20:03 +00:00
pull_merge.go fix(pulls): report the real reason when a merge is refused (#1107) 2026-09-09 19:15:46 +00:00
pull_merge_test.go fix(pulls): report the real reason when a merge is refused (#1107) 2026-09-09 19:15:46 +00:00
pull_review.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
pull_review_comment.go Add reply to code review (#978) 2026-06-26 21:40:31 +00:00
repo_clone.go Move sdk from code.gitea.io/sdk/gitea to gitea.dev/sdk (#1006) 2026-05-26 04:51:09 +00:00
wiki.go feat: add wiki CLI commands (#998) 2026-05-26 21:14:47 +00:00
wiki_test.go feat: add wiki CLI commands (#998) 2026-05-26 21:14:47 +00:00