Fixes https://gitea.com/gitea/cli/issues/108
Several transport timeout tests used 20-300ms real-time timeouts, which a busy machine such as a parallel `makepkg` check can exceed just connecting to the local test server. They now run in a `testing/synctest` bubble over in-memory connections, so a timeout runs out only once every goroutine is idle, whatever the load of the machine.
Reviewed-on: https://gitea.com/gitea/cli/pulls/110
Reviewed-by: silverwind <[email protected]>
`gh pr merge`, `checks` and `create` have options that `gt pr` lacked:
- `gt pr merge --admin` merges past the branch protection (Gitea's `force_merge`, for those who administer the repository). `--match-head-commit SHA` merges only while the head is still that commit and fails with the `head_mismatch` exit status otherwise, so a push after the review is not merged unseen. `--disable-auto` cancels the merge that `--auto` scheduled and merges nothing; with none scheduled it says so.
- `gt pr checks --required` shows and awaits only the checks that the protection rule of the base branch requires (`effective_branch_protection_name`, then its `status_check_contexts`, where `*` and `?` match). A flaky optional check no longer holds `--watch` back, and a branch that requires none has nothing to show.
- `gt pr create --fill-first` takes the title and body from the first commit of the branch whatever their number; `--fill-verbose` takes the body from the full message of every commit, oldest first. `--fill` is unchanged. `--fill`, `--fill-first` and `--fill-verbose` cannot be combined, like gh.
`gh pr checks --fail-fast` is not added: `gt pr checks --watch` already stops at the first failure.
Tested against fake servers, and on the disposable Gitea 28 instance by three integration tests: a merge with a moved head, an administrator merging past a protection that wants an approval, a scheduled merge that is canceled and then does not happen, required against optional checks with `--watch`, and `--fill-first` and `--fill-verbose` from a real clone. The test of the cancel showed that Gitea answers a cancel with nothing scheduled with the same bare 404 as for a missing pull request, which the code now reads as "nothing scheduled".
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/97
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gt` could not look at commits: no listing, no single commit, no diff of one, no statuses, so reading history on the server meant `gt api` or a clone.
`gt commit` reads the repository on the server, with the SDK's commit endpoints:
- `list [<ref>]` (`--path`, `--not`, `--limit`, `--page`), `view <ref>`, `diff <ref>`, `compare <base>...<head>`, `status <ref>` and `pr <sha>`. A ref is a SHA, branch or tag.
- The additions, deletions, files and signature check of `--json` cost the server extra work and are read only when the output includes them.
- `status` exits 1 when a status failed and 8 while one is pending, like `gt pr checks`, so `gt commit status main && deploy` waits for green.
Diffs get filters like the file tree of the web interface. Gitea's API takes no options for what a diff contains (whitespace included), so they work on the diff once it is read, and what is left is still a diff that `git apply` takes:
- `--path` and `--exclude` take a file, a `dir/` or a glob (`*.go`, `internal/**/*_test.go`), repeatable.
- `--name-only`, `--name-status` and `--stat` summarize it.
- `gt commit diff` and `gt pr diff` share them; `commit diff --patch` writes the patch `git am` takes.
Tried against gitea.com for every subcommand. Writing statuses and tags are left for other changes.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/92
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
On Windows, opening `config.yml` while another process replaces it fails with a sharing violation. `AtomicWrite` already retries its rename, but the unlocked reads did not, so any `gt` could fail while another updated its settings. This also made `TestConcurrentUpdatesAndHostSeparation` flaky in CI.
Reads of the settings and credential files now retry for up to 2 seconds on that error only, so a file that really is unreadable still fails at once.
---------
Co-authored-by: silverwind <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/105
Reviewed-by: Zettat123 <[email protected]>
Commands run inside a clone spawned up to 11 Git processes, and pull request lookups read every page one request at a time, which made common commands slow.
Git probes are now read once per command and concurrently, and any other Git command clears them. List pages and independent searches run concurrently, and `pr view --json` skips reviews it does not need.
Medians of 15 to 21 interleaved runs of `main` and this branch against a local fake server with 500 open pull requests:
| Command | 30 ms latency | No latency |
|---|---|---|
| `pr status` in a clone | 732 → 348 ms | 137 → 62 ms |
| `pr view` on the current branch | 583 → 283 ms | 124 → 62 ms |
| `pr checks` on the current branch | 528 → 240 ms | 124 → 61 ms |
| `status` in a clone | 352 → 154 ms | 80 → 40 ms |
| `issue list` in a clone | 114 → 72 ms | 78 → 39 ms |
| `pr list -R` | 49 → 49 ms | 15 → 15 ms |
Reviewed-on: https://gitea.com/gitea/cli/pulls/103
Reviewed-by: TheFox0x7 <[email protected]>
Use the same linters, settings and formatters as Gitea's `.golangci.yml`, so code moving between the two projects meets the same bar. Rules that only apply to Gitea's codebase (its json/ini/cache wrappers, migrations, swagger, process wrapper) are left out, this repo's extra checks (`misspell`, `copyloopvar`, a few revive rules) are kept.
`gci` now owns import grouping (standard, `gitea.dev`, others), so `make fmt` and `make fmt-check` run `golangci-lint fmt`. The unused `.revive.toml` is removed. The rest of the diff fixes the newly reported issues without behavior changes.
_Written by Claude (Opus 5.5)._
Reviewed-on: https://gitea.com/gitea/cli/pulls/104
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: silverwind <[email protected]>
The SDK has the activity feeds of Gitea, but `gt` had no command for them, so to see what happened lately in a repository or an organization one went to the web interface.
- `gt activity [<owner>]` shows the feed of a user or organization, yours without an owner, newest first. `--only-performed-by` keeps what the user did, not what others did in their repositories.
- `gt repo activity` shows the feed of a repository.
- `--date YYYY-MM-DD` keeps one day (checked before any request), `--limit` and `--page` page it, and `--json` gives `id, type, actor, repository, ref, content, private, comment_id, created_at`. The table says what was done in words ("opened issue", "pushed to") with the issue or pull request, the comment, or the commits and branch.
The integration test runs as a user of its own, because it showed that Gitea 28.3 answers the feed of a user with a 500 (a nil pointer in its permission check) once one entry is about a repository that was deleted. A push is recorded in the background, so a test that deletes its repository right after pushing leaves such an entry, and it then breaks the feed of the whole account. That is a Gitea bug that gt cannot work around; the repository and organization feeds are not affected.
Tested against a fake server and on the disposable Gitea 28 instance: every kind of entry of a repository, the date filter, pages, the feed of the account with and without `--only-performed-by`, and that of an organization.
---------
Co-authored-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Three more options of `gh` that `gt` lacked:
- `gt release list --exclude-drafts --exclude-pre-releases --order asc|desc`. The two filters are sent to Gitea. Gitea lists releases by the date of each tag's commit and cannot sort otherwise, so `--order` reads every release and sorts them by when they were made (`published_at`, since `created_at` of a published release is the commit's date); without it the order is Gitea's.
- `gt run view --log-failed` prints the logs of the jobs that failed or were canceled, `--job NAME|ID` views one job of the run or, with `--log`, prints its log. `--attempt` is not added: Gitea has no API to read an earlier attempt of a run.
- `gt api --paginate --slurp` prints the pages as one JSON array of them, so a script parses one document; like gh, it cannot be combined with `--jq`. `gh api --cache` is not added.
Tested against fake servers and on the disposable Gitea 28 instance: releases of every kind in separate seconds, a run with two jobs that waits for a runner and is canceled, and five issues read in pages of two. The release test showed two quirks of Gitea that the code and the help now reflect: its order is by the tag's date, so a release made later can come first, and `created_at` of a published release is the commit's date.
---------
Co-authored-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gt` could make a release, which makes a tag, but not list, view, create or delete a tag without one, nor protect tags, so those went through `git`, the web interface or `gt api`.
`gt tag` works on the server with the SDK's tag endpoints and needs no clone:
- `list`, `view <tag>`, `create <tag> [--target REF] [--message TEXT]` and `delete <tag>...`. A message makes an annotated tag; `view` and `--json` then give the tagger, date and signature check.
- `protect <pattern>...` adds or updates a tag protection rule (`--allow-user`, `--allow-team`, replacing only the lists that are named), `unprotect <pattern>...` removes it and `protection list` lists them.
- `create`, `delete`, `protect` and `unprotect` take `--dry-run`, with cases in the dry-run tests. Deleting asks first.
Tried against gitea.com for `list`, `view`, `--json` and a missing tag. TestGiteaTagLifecycleAndProtection covers creating, deleting and the protection rules on a disposable Gitea.
---------
Co-authored-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Adds Gitea's issue stopwatch to `gt time`: `start`, `stop` (logs the elapsed time), `cancel` (discards it) and `status` (every active stopwatch of the user, across repositories). Gitea's 409/404 replies are turned into plain messages, and the write commands support `--dry-run`.
Covered by unit tests and a `TestGiteaTimeStopwatch` integration test against a real Gitea 28.3.
---------
Co-authored-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gt branch protect` and `unprotect` change protection rules, but nothing listed them: `gt branch view` only says how many approvals a branch needs, so to see who may push or which checks are required one went to the web interface or `gt api`.
- `gt branch protection list` lists the rules in the order Gitea applies them: the branch or pattern, the approvals, who may push directly, the status checks and the other protections that are on. `--json` has every setting (`push_users`, `merge_users`, `status_checks`, `require_signed_commits` and more, as in the SDK).
- `gt branch protection view <rule>` shows one rule in full. The rule is named as the list shows it, a branch or a pattern such as `release/*`.
- A rule that does not require status checks lists none, whatever contexts Gitea still holds for it.
Gitea answers all rules at once and ignores pages, so the list has no `--limit` or `--page`. A branch is protected by the first rule in the list that matches it, which the integration test checks on a real Gitea 28 with overlapping rules.
Tested against a fake server and by `TestGiteaBranchProtections` on the disposable Gitea 28 instance, which protects, edits, lists, views and unprotects rules and compares with `gt branch view`.
---------
Co-authored-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gt upgrade --nightly` and the install scripts' nightly option could fail with a checksum mismatch, or silently install an old build. dl.gitea.com serves `gitea-cli/main/` like a released version, with `cache-control: public, max-age=31536000, immutable`, but each nightly overwrites those files, and each file then leaves the cache on its own. `gitea-cli-main-linux-amd64.xz` was still a build from Nov 2 while its `.sha256` was from Nov 5.
Directories with `nightly` in their name, such as `gitea/main-nightly` and `gitea-runner/nightly`, get `max-age=300, must-revalidate`, so nightlies now go to `gitea-cli/main-nightly`, named like Gitea's.
The v1.0.0 and v1.1.0 binaries still look in `main`, so their `gt upgrade --nightly` stays on the last build there until they upgrade to a release with this change. The CDN's rule isn't in this repository: the headers of the first nightly after this merge will confirm it applies.
Reviewed-on: https://gitea.com/gitea/cli/pulls/102
Reviewed-by: techknowlogick <[email protected]>
The commands added lately have unit tests against fake servers, but a fake server only knows what its author expected of Gitea. These integration tests run them against the disposable Gitea 28 instance of `make integration-test` and check the outcome on the instance.
- `gt runner`: every scope (repository, organization, account, instance). A runner is registered over the connect protocol with the token that `gt runner token` printed, then listed, viewed, disabled, enabled and deleted.
- `gt gpg-key`: create, view, list, token, verify and delete, with a throwaway key that signs the token.
- `gt issue` and `gt pr` lock, unlock, pin, unpin and delete; dependencies in both directions for issues and pull requests, including a cycle that Gitea refuses.
- `gt repo license` and `gt repo gitignore`, `--template` on real list output, and `--dry-run` on more than twenty writes of many kinds, each checked on the instance to have changed nothing.
They found that the unit-test assumptions held except in a few places of detail (a key's `public_key` has no armor, a key verified by signature keeps no emails), now pinned down. The whole `make integration-test` passes with `-race`.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/94
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gh repo license` and `gh repo gitignore` list and print the templates a new repository can start from; `gt repo create --license` and `--gitignores` take their keys, but `gt` gave no way to see which exist or what they say.
- `gt repo license list` and `view <key>`, `gt repo gitignore list` and `view <name>`, with `--json` (`key, name, url, body, implementation` and `name, source`).
- `view` prints only the text, unchanged unless stdout is a terminal, so `gt repo license view MIT > LICENSE` and `gt repo gitignore view Go >> .gitignore` work. Gitea matches names exactly; gt retries without regard to case, so `mit` and `go` work.
Checked against gitea.com for list, view, the case-insensitive match and a missing name.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/83
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gh issue` can lock, unlock, pin, unpin and delete issues; `gt issue` could only close and reopen them, so these went through the web interface or `gt api`. The SDK has all five operations.
- `gt issue lock {<number> | <url>}... [--reason TEXT]`, `unlock`, `pin`, `unpin` and `delete` take several issues, report each like `gt issue close`, and return the issues with `--json`.
- Lock and pin also work on pull request numbers, as Gitea allows. `delete` refuses pull requests, looks at every issue before it deletes any, and asks once for the batch (`--yes` skips it).
- Gitea does not check the lock reason: it offers "Too heated", "Off-topic", "Resolved" and "Spam" by default and administrators can change them, so `--reason` is free text.
`--dry-run` is not added here: the dry run answers a withheld `PUT` with 200 and a `POST` with 201, and the SDK expects 204 for lock and pin. That belongs to the PR that extends `--dry-run` to all writes.
Tested against a fake server only; the commands change issues, so they were not run on a real instance.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/82
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`TestIssueEditAddsToAndRemovesFromProjects` fails CI at random under `-race`: gt reads a project's columns concurrently, and the test's handler counted those requests in a map without a lock. The count now takes a mutex.
Reviewed-on: https://gitea.com/gitea/cli/pulls/84
Reviewed-by: Lunny Xiao <[email protected]>
Co-authored-by: bircni <[email protected]>
There was no way to preview a write before running it.
`--dry-run` on `issue close/reopen`, `pr close/reopen/merge`, `release delete`, `repo delete`, `label delete` and `branch delete` withholds the write requests in the HTTP client, answers them with a success so the command runs to its end, and prints them. Local Git changes are skipped.
`TestDryRunFlagsHaveCases` makes every command with the flag prove that it sends no write and leaves the clone alone. Since nothing is sent, a preview cannot show a write that Gitea would refuse.
Split out of https://gitea.com/gitea/cli/pulls/58. Closes https://gitea.com/gitea/cli/issues/70
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/73
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
gt requires Gitea 28, but a feature that needs a newer release would fail with a bare 404 on 28.
A command or flag that needs something newer now goes into `commandVersions` or `flagVersions`. gt asks the server for its version once, only when something requires one, and fails with a usage error such as "gt project workflow list requires Gitea 29 or newer; host runs Gitea 28.3.0" before the request. Help text states the requirement.
28 stays the minimum and nothing below it is tracked, so both tables start empty; https://gitea.com/gitea/cli/pulls/61 will be the first user. Entries are removed when the minimum rises. Forgejo's `11.0.0+gitea-1.22.0` is compared as Gitea 1.22.0.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/67
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
`gt admin` only managed accounts, while the SDK also exposes rename, SSH keys, badges, organizations, cron tasks and email addresses for administrators.
This adds `admin user rename|key|badge`, `admin org list|create`, `admin cron list|run` and `admin email list`. Admin repository creation for another user is already served by `gt repo create USER/NAME`. Unadopted repositories are left out because Gitea is going to remove that feature.
Assisted-by: Codet:codet
Co-authored-by: bircni <[email protected]>
Co-authored-by: silverwind <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/78
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Automatically detect the Gitea server URL inside Gtea actions to enable users to run `gt` without specifying `GITEA_INSTANCE_URL`, e.g. like `gh` on GitHub:
```yaml
env:
GITEA_TOKEN: ${{ gitea.token }}
```
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/77
Reviewed-by: bircni <[email protected]>
Co-authored-by: silverwind <[email protected]>
gt ships Windows builds, but CI only runs the tests on Linux; Windows is only vetted.
gitea.com has no Windows runners, so a new weekly and on-demand workflow installs Windows Server 2025 Core in a [dockur/windows](https://github.com/dockur/windows) QEMU VM and runs the cross-compiled unit test binaries there, the way https://gitea.com/gitea/runner/pulls/1348 does for the runner. Without `/dev/kvm` on the hosts, Windows is emulated and a run takes about two hours.
The first runs also found Windows bugs, fixed here: replacing a settings or credential file that another reader holds open failed, and `gt upgrade` left the old executable behind.
Reviewed-on: https://gitea.com/gitea/cli/pulls/64
`detectInstallation` resolved symlinks on the real filesystem, so `TestDetectInstallation` failed on machines where `/usr/local/bin/gt` is a Homebrew symlink into `Cellar`: the test's `/usr/local/bin/gt` case was classified as Homebrew.
Symlinks are now resolved in `installation()`, its only caller, so `detectInstallation` depends only on its inputs and the test is self-contained on every OS.
_Written by Claude (Opus 5.5)._
Reviewed-on: https://gitea.com/gitea/cli/pulls/76
Reviewed-by: bircni <[email protected]>
Co-authored-by: silverwind <[email protected]>
Renovate mistook the image version tags of `mcr.microsoft.com/devcontainers/go` for Go versions and moved the devcontainer to `2.3-trixie`, which follows the image's default Go instead of the one in `go.mod`. Back to `1.27-trixie`. https://gitea.com/gitea/renovate-config/pulls/562 makes the shared Renovate config ignore the `2.x` tags.
_Written by Claude (Opus 5.5)._
Reviewed-on: https://gitea.com/gitea/cli/pulls/75
Reviewed-by: bircni <[email protected]>
Co-authored-by: silverwind <[email protected]>
Closes https://gitea.com/gitea/cli/issues/45
With several instances configured and no default, `gt repo clone OWNER/REPO` without `--host` stopped with "instance
required". With `--find-instance`, it now looks the repository up on each instance with an account, without prompting.
If one has it, gt clones from there. If several do, gt asks which one on a terminal, and under `--no-input` it fails
with a usage error that lists them. An instance that can't be checked, for example because it's down or the token
expired, gets a warning, and if no instance has the repository gt returns that error instead of "not found".
The lookup is opt-in because it sends the repository name to every instance with an account, so the name of a private
repository on one instance also reaches the others, and gt clones from the only instance that has it.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/66
Reviewed-by: bircni <[email protected]>
Co-authored-by: JorgeDLMV <[email protected]>
gt had no way to update itself, and nothing told users a new release was out.
`gt upgrade` replaces gt with the latest release (or `--version`, `--nightly`) from dl.gitea.com and verifies its SHA-256 like the install script. Homebrew, Linux package, Nix and `go install` installations are left to those tools, and the error names the right command.
Like gh, gt now checks gitea.com for a newer release at most once a day and shows a notice after a command that succeeds. The check runs in the background, so a command never waits for it; it is off in CI, when output is not a terminal, and when `GITEA_CLI_NO_UPDATE_NOTIFIER` is set.
Reviewed-on: https://gitea.com/gitea/cli/pulls/63
When a pull request for the same branches already exists, `gt pr create` adds "see <url>" to the error. It found that pull request with `GET /repos/{owner}/{repo}/pulls/{base}/{head}`, which returns any pull request for those branches, open or closed. If the branches had an earlier pull request that was closed, the hint could link that one instead of the open one.
Gitea's 409 already names the open pull request, as `issue_id` next to the database `id`. gt now reads the number from there and links that pull request. If it can't be read, the hint still names it as `#N`.
Written with help from Claude (Opus 5.5). I reviewed and tested the change myself.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/65
Reviewed-by: bircni <[email protected]>
Co-authored-by: JorgeDLMV <[email protected]>
Adds `gt project` with `list`, `view`, `create`, `edit`, `close`, `reopen` and `delete` for the project boards of a repository or, with `--org`, of an organization. Projects are addressed by title or ID, like milestones and labels.
Until now `gt` only touched projects through `issue edit --add-project` and `issue move`. Project workflows are not included: the SDK in use (v1.5.0) has no workflow API yet, so they follow once it does.
Assisted-by: Codet:codet
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/60
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Jobs that never start usually wait for a runner, but `gt` could only say so: it had no way to see or manage runners, so people switched to the web interface or `gt api`.
`gt runner` adds, on the SDK's runner endpoints:
- `list` (`--disabled`, `--enabled`), `view <id>`, `disable <id>`, `enable <id>` and `delete <id>`, with `--json` fields `id, name, status, busy, disabled, ephemeral, labels`.
- `token` prints the registration token for a new runner, for `act_runner register --token "$(gt runner token)"`.
- The scope is the repository by default, or `--org`, `--account` or `--global` (administrators), like `gt webhook`.
Disabling an already disabled runner sends nothing. `list`, `view` and an error for a missing runner were checked against gitea.com; disable, enable, delete and token were tested only against a fake server.
---------
Co-authored-by: bircni <[email protected]>
Reviewed-on: https://gitea.com/gitea/cli/pulls/62
Reviewed-by: bircni <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
Servers such as Forgejo answer 404 on the workflow and job listings that Gitea has. gt reported that as a missing repository or run, and `run list` and `run view` failed although the runs themselves were readable.
A 404 for a repository or run that exists now reads as an unsupported endpoint. `run list`, `run view` and `run delete` warn and go on without workflow names or jobs; commands that need them (`workflow list`, `run logs`, `run watch`) fail with that message instead of "not found". This is best-effort Forgejo support, not a commitment to full compatibility.
Fixes https://gitea.com/gitea/cli/issues/53
Fixes https://gitea.com/gitea/cli/issues/54
Reviewed-on: https://gitea.com/gitea/cli/pulls/56
Several packages had large untested areas: services (70%), git (75%), auth (76%) and extensions/github (68%), mostly in request building, error wording and config handling. This raises every package that does real work above 80% (87% overall) with tests that check behavior: payloads and paths sent to the API, refusals and their messages, TLS and credential config staying scoped to the instance, request signatures a verifier accepts.
The e2e suite only covered part of the commands. New `TestGitea*` tests cover issue and pull request state, comments and attachments, draft/ready, diff, update-branch, deploy keys, fork/rename/archive/transfer, generic packages and workflow enable/disable/run.
`cmd/gt` and `tools/cli-docs` stay below 80%: the gap is their `main()` wrappers.
Reviewed-on: https://gitea.com/gitea/cli/pulls/55
`gt pr list --local` lists the local branches of the clone with the pull request each belongs to and whether it is open, closed or merged, like `git branch -vv`, so it shows which branches `gt pr clean` can remove. Branches are matched like `pr status` and `pr clean` do: the number `pr checkout` recorded, the upstream, the branch name, then the head commit for AGit pull requests. It reads all open pull requests and closed ones only back to the oldest unmatched branch.
Closes https://gitea.com/gitea/cli/issues/47
Reviewed-on: https://gitea.com/gitea/cli/pulls/51
Reviewed-by: Lunny Xiao <[email protected]>
Adds a global `--csv [FIELDS]` flag on every command that supports `--json`: a header row, then one row per item, with nested values as compact JSON. It reuses the JSON field list, validation and completion, and cannot be combined with `--json` or `--jq`. CSV was only possible through `--jq '@csv'`, which needs the fields spelled out twice.
A PDF report is left out: it needs a heavy dependency for a rare need.
Closes https://gitea.com/gitea/cli/issues/49
Reviewed-on: https://gitea.com/gitea/cli/pulls/50
Reviewed-by: Lunny Xiao <[email protected]>