Compare commits
115 Commits
Author | SHA1 | Date |
---|---|---|
Renovate Bot | a35bf931ae | |
Renovate Bot | edf9f23390 | |
Renovate Bot | 0297738b33 | |
Renovate Bot | 1983c3bbd9 | |
Renovate Bot | d289c290bb | |
harryzcy | 100c5a9eee | |
Renovate Bot | 4ba3139224 | |
Renovate Bot | dd80463cf5 | |
techknowlogick | 93480ac98e | |
techknowlogick | f7e2c6f89b | |
Jake Hillion | 493b29afbf | |
Dan Čermák | 723b0553c5 | |
danebou | 4c0cef090d | |
leonard.vimond | 20479663f0 | |
Renovate Bot | 22370698bf | |
Renovate Bot | 6d5e8d3b58 | |
Renovate Bot | 18abf24dca | |
Renovate Bot | 7cb6a84098 | |
techknowlogick | 7e700e36f8 | |
Renovate Bot | 61bdc14184 | |
Renovate Bot | 16b37cc6da | |
Renovate Bot | b5d7119ab4 | |
Renovate Bot | 610d04fc85 | |
Renovate Bot | 6696e945c6 | |
Renovate Bot | 5158adbcf2 | |
Lunny Xiao | 6e473ec601 | |
Renovate Bot | 115f25e85f | |
Renovate Bot | 656d48ec8d | |
Renovate Bot | 2cb450401c | |
techknowlogick | 5236a89d4c | |
techknowlogick | 48d2997a63 | |
techknowlogick | 75a7d4b7cc | |
techknowlogick | 1e3043ce6f | |
techknowlogick | 218b991069 | |
techknowlogick | 16a3594474 | |
techknowlogick | b1b31da7c8 | |
Lunny Xiao | 36672485d1 | |
Renovate Bot | 4fedaaafe1 | |
Renovate Bot | 6ae3718574 | |
Renovate Bot | c4f6231c49 | |
Renovate Bot | 76f7f901fc | |
Renovate Bot | 005beca233 | |
Renovate Bot | e62713f42a | |
John Olheiser | c8c8e9758b | |
Renovate Bot | d15af88f83 | |
Renovate Bot | c74177556b | |
Renovate Bot | 02836d8e52 | |
Konstantin Podsvirov | b8ad55117a | |
Renovate Bot | fb4eb8be9c | |
Renovate Bot | 81b784d7a5 | |
Renovate Bot | 649b0b1272 | |
Renovate Bot | 3c9552c531 | |
techknowlogick | f28ddccd90 | |
Renovate Bot | 5beb5bf56b | |
Renovate Bot | 17e09a3c2d | |
Renovate Bot | 58962cbb65 | |
Renovate Bot | 7029e7e8c5 | |
Renovate Bot | 3e8047dfe6 | |
techknowlogick | 897dc50bfe | |
Renovate Bot | 2f1ca85b25 | |
Lunny Xiao | e6a6aa6f49 | |
Renovate Bot | bcda543bb8 | |
Sienna Lloyd | 9e5db56dcf | |
techknowlogick | 92d49e383d | |
techknowlogick | 2a666c84cb | |
techknowlogick | 32b9f5e836 | |
techknowlogick | 33442fd05f | |
Renovate Bot | f2cf5b7979 | |
techknowlogick | d80c8ceffd | |
Renovate Bot | e3b4d68af7 | |
techknowlogick | 0df93dd47a | |
jolheiser | 66b4decdd1 | |
techknowlogick | 9e1919ec0a | |
Renovate Bot | 615cd31eb2 | |
techknowlogick | b868d30434 | |
Renovate Bot | 2d57e07dc7 | |
Renovate Bot | 3343fedc17 | |
Renovate Bot | f9c67f35a6 | |
Renovate Bot | dd8d7fb30f | |
Renovate Bot | 17453fd7cb | |
Renovate Bot | fe4551142a | |
mvaldes14 | 10bd00d066 | |
jolheiser | 0869c15a6c | |
Martin Veldwijk | e4e8eb07d2 | |
John Olheiser | 620f236723 | |
Martin Veldwijk | 77837e909e | |
6543 | 5582f92df4 | |
vsysoev | c72c6c0679 | |
Grady Wong | b2d845b8c7 | |
Bo-Yi Wu | 07039b82e3 | |
appleboy | 7040c350ae | |
appleboy | b02263adb0 | |
appleboy | 4915862b95 | |
appleboy | cd6a7b35c3 | |
ASDFGamer | abcaa58312 | |
ASDFGamer | d9da952e96 | |
Lunny Xiao | 7f335a2b9c | |
6543 | b510756438 | |
techknowlogick | 3640bbac5e | |
techknowlogick | b705188599 | |
6543 | cfce25f0a7 | |
6543 | e783f4ea4a | |
John Olheiser | 342b573d45 | |
Lunny Xiao | 1a6d9b343a | |
techknowlogick | faa9858a7e | |
techknowlogick | e51eb1a00e | |
Wim | 6a848cb72a | |
Norwin | 2a8c1daa67 | |
6543 | 54b535a527 | |
6543 | c1c7870ceb | |
6543 | a37377d181 | |
6543 | 15457f1770 | |
Norwin | 4487213581 | |
Wim | 6a4ba6a689 | |
6543 | 4ee5ce4b52 |
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "Tea DevContainer",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/go:1.22-bullseye",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/git-lfs:1.2.2": {}
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"settings": {},
|
||||||
|
"extensions": [
|
||||||
|
"editorconfig.editorconfig",
|
||||||
|
"golang.go",
|
||||||
|
"stylelint.vscode-stylelint",
|
||||||
|
"DavidAnson.vscode-markdownlint",
|
||||||
|
"ms-azuretools.vscode-docker",
|
||||||
|
"GitHub.vscode-pull-request-github"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
202
.drone.yml
202
.drone.yml
|
@ -1,202 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: vendor
|
|
||||||
pull: always
|
|
||||||
image: golang:1.18
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
commands:
|
|
||||||
- make vendor # use vendor folder as cache
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
pull: always
|
|
||||||
image: golang:1.18
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
commands:
|
|
||||||
- make clean
|
|
||||||
- make vet
|
|
||||||
- make lint
|
|
||||||
- make fmt-check
|
|
||||||
- make misspell-check
|
|
||||||
- make build
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: unit-test
|
|
||||||
image: golang:1.18
|
|
||||||
commands:
|
|
||||||
- make unit-test-coverage
|
|
||||||
settings:
|
|
||||||
group: test
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: release-test
|
|
||||||
image: golang:1.18
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
settings:
|
|
||||||
group: test
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- "release/*"
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
- name: tag-test
|
|
||||||
pull: always
|
|
||||||
image: golang:1.18
|
|
||||||
commands:
|
|
||||||
- make test
|
|
||||||
settings:
|
|
||||||
group: test
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
- name: static
|
|
||||||
image: golang:1.18
|
|
||||||
environment:
|
|
||||||
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
|
||||||
commands:
|
|
||||||
- make release
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
- name: gpg-sign
|
|
||||||
pull: always
|
|
||||||
image: plugins/gpgsign:1
|
|
||||||
settings:
|
|
||||||
detach_sign: true
|
|
||||||
excludes:
|
|
||||||
- "dist/release/*.sha256"
|
|
||||||
files:
|
|
||||||
- "dist/release/*"
|
|
||||||
environment:
|
|
||||||
GPGSIGN_KEY:
|
|
||||||
from_secret: gpgsign_key
|
|
||||||
GPGSIGN_PASSPHRASE:
|
|
||||||
from_secret: gpgsign_passphrase
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
|
|
||||||
- name: tag-release
|
|
||||||
pull: always
|
|
||||||
image: woodpeckerci/plugin-s3:latest
|
|
||||||
settings:
|
|
||||||
acl: public-read
|
|
||||||
bucket: gitea-artifacts
|
|
||||||
endpoint:
|
|
||||||
from_secret: aws_endpoint
|
|
||||||
path_style: true
|
|
||||||
source: "dist/release/*"
|
|
||||||
strip_prefix: dist/release/
|
|
||||||
target: "/tea/${DRONE_TAG##v}"
|
|
||||||
environment:
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
from_secret: aws_access_key_id
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
from_secret: aws_secret_access_key
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
- name: release-branch-release
|
|
||||||
pull: always
|
|
||||||
image: woodpeckerci/plugin-s3:latest
|
|
||||||
settings:
|
|
||||||
acl: public-read
|
|
||||||
bucket: gitea-artifacts
|
|
||||||
endpoint:
|
|
||||||
from_secret: aws_endpoint
|
|
||||||
source: "dist/release/*"
|
|
||||||
strip_prefix: dist/release/
|
|
||||||
target: "/tea/${DRONE_BRANCH##release/v}"
|
|
||||||
environment:
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
from_secret: aws_access_key_id
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
from_secret: aws_secret_access_key
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- "release/*"
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
- name: release
|
|
||||||
pull: always
|
|
||||||
image: woodpeckerci/plugin-s3:latest
|
|
||||||
settings:
|
|
||||||
acl: public-read
|
|
||||||
bucket: gitea-artifacts
|
|
||||||
endpoint:
|
|
||||||
from_secret: aws_endpoint
|
|
||||||
source: "dist/release/*"
|
|
||||||
strip_prefix: dist/release/
|
|
||||||
target: /tea/main
|
|
||||||
environment:
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
from_secret: aws_access_key_id
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
from_secret: aws_secret_access_key
|
|
||||||
when:
|
|
||||||
branch:
|
|
||||||
- main
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
- name: gitea
|
|
||||||
pull: always
|
|
||||||
image: plugins/gitea-release:1
|
|
||||||
settings:
|
|
||||||
files:
|
|
||||||
- "dist/release/*"
|
|
||||||
base_url: https://gitea.com
|
|
||||||
api_key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- tag
|
|
||||||
|
|
||||||
- name: discord
|
|
||||||
pull: always
|
|
||||||
image: appleboy/drone-discord:1.0.0
|
|
||||||
environment:
|
|
||||||
DISCORD_WEBHOOK_ID:
|
|
||||||
from_secret: discord_webhook_id
|
|
||||||
DISCORD_WEBHOOK_TOKEN:
|
|
||||||
from_secret: discord_webhook_token
|
|
||||||
when:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- tag
|
|
||||||
- pull_request
|
|
||||||
status:
|
|
||||||
- changed
|
|
||||||
- failure
|
|
|
@ -8,7 +8,7 @@ labels:
|
||||||
|
|
||||||
### describe your environment
|
### describe your environment
|
||||||
- tea version used (`tea -v`):
|
- tea version used (`tea -v`):
|
||||||
- [ ] I also reproduced the issue [with the latest master build](https://dl.gitea.io/tea/master)
|
- [ ] I also reproduced the issue [with the latest main build](https://dl.gitea.com/tea/main/)
|
||||||
- Gitea version used:
|
- Gitea version used:
|
||||||
- [ ] the issue only occurred after updating gitea recently
|
- [ ] the issue only occurred after updating gitea recently
|
||||||
- operating system:
|
- operating system:
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
name: goreleaser
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
goreleaser:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- run: git fetch --force --tags
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: "go.mod"
|
||||||
|
- name: import gpg
|
||||||
|
id: import_gpg
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
||||||
|
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
|
- name: goreleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
distribution: goreleaser-pro
|
||||||
|
version: "~> v1"
|
||||||
|
args: release --nightly
|
||||||
|
env:
|
||||||
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
S3_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
S3_BUCKET: ${{ secrets.AWS_BUCKET }}
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
|
GPGSIGN_PASSPHRASE: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
release-image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_ORG: gitea
|
||||||
|
DOCKER_LATEST: nightly
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # all history for all branches and tags
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker BuildX
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
env:
|
||||||
|
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitea/tea:latest
|
|
@ -0,0 +1,42 @@
|
||||||
|
name: goreleaser
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
goreleaser:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- run: git fetch --force --tags
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: 'go.mod'
|
||||||
|
- name: import gpg
|
||||||
|
id: import_gpg
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
||||||
|
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
|
fingerprint: CC64B1DB67ABBEECAB24B6455FC346329753F4B0
|
||||||
|
- name: goreleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
distribution: goreleaser-pro
|
||||||
|
version: "~> v1"
|
||||||
|
args: release
|
||||||
|
env:
|
||||||
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
S3_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
S3_BUCKET: ${{ secrets.AWS_BUCKET }}
|
||||||
|
GORELEASER_FORCE_TOKEN: 'gitea'
|
||||||
|
GPGSIGN_PASSPHRASE: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
||||||
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
||||||
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: check-and-test
|
||||||
|
|
||||||
|
on:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-and-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: 'go.mod'
|
||||||
|
- name: lint and build
|
||||||
|
run: |
|
||||||
|
make clean
|
||||||
|
make vet
|
||||||
|
make lint
|
||||||
|
make fmt-check
|
||||||
|
make misspell-check
|
||||||
|
make docs-check
|
||||||
|
make build
|
||||||
|
env:
|
||||||
|
GOPROXY: https://goproxy.io,direct
|
||||||
|
- name: test and coverage
|
||||||
|
run: |
|
||||||
|
make test
|
||||||
|
make unit-test-coverage
|
||||||
|
env:
|
||||||
|
GOPROXY: https://goproxy.io,direct
|
|
@ -1,5 +1,6 @@
|
||||||
tea
|
tea
|
||||||
/gitea-vet
|
/gitea-vet
|
||||||
|
/gitea-vet.exe
|
||||||
|
|
||||||
.idea/
|
.idea/
|
||||||
.history/
|
.history/
|
||||||
|
@ -7,3 +8,7 @@ dist/
|
||||||
|
|
||||||
.vscode/
|
.vscode/
|
||||||
vendor/
|
vendor/
|
||||||
|
|
||||||
|
coverage.out
|
||||||
|
|
||||||
|
dist/
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "usage: $0 <path>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUM=$(shasum -a 256 "$1" | cut -d' ' -f1)
|
||||||
|
BASENAME=$(basename "$1")
|
||||||
|
echo -n "${SUM} ${BASENAME}" > "$1".sha256
|
|
@ -0,0 +1,124 @@
|
||||||
|
before:
|
||||||
|
hooks:
|
||||||
|
- go mod tidy
|
||||||
|
|
||||||
|
builds:
|
||||||
|
- env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- linux
|
||||||
|
- windows
|
||||||
|
- freebsd
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
- arm
|
||||||
|
- arm64
|
||||||
|
goarm:
|
||||||
|
- "5"
|
||||||
|
- "6"
|
||||||
|
- "7"
|
||||||
|
ignore:
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm
|
||||||
|
- goos: darwin
|
||||||
|
goarch: ppc64le
|
||||||
|
- goos: darwin
|
||||||
|
goarch: s390x
|
||||||
|
- goos: windows
|
||||||
|
goarch: ppc64le
|
||||||
|
- goos: windows
|
||||||
|
goarch: s390x
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm
|
||||||
|
goarm: "5"
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm
|
||||||
|
goarm: "6"
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm
|
||||||
|
goarm: "7"
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: ppc64le
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: s390x
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm
|
||||||
|
goarm: "5"
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm
|
||||||
|
goarm: "6"
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm
|
||||||
|
goarm: "7"
|
||||||
|
- goos: freebsd
|
||||||
|
goarch: arm64
|
||||||
|
flags:
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -s -w -X main.Version={{ .Version }}
|
||||||
|
binary: >-
|
||||||
|
{{ .ProjectName }}-
|
||||||
|
{{- .Version }}-
|
||||||
|
{{- .Os }}-
|
||||||
|
{{- if eq .Arch "amd64" }}amd64
|
||||||
|
{{- else if eq .Arch "amd64_v1" }}amd64
|
||||||
|
{{- else if eq .Arch "386" }}386
|
||||||
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
|
{{- if .Arm }}-{{ .Arm }}{{ end }}
|
||||||
|
no_unique_dist_dir: true
|
||||||
|
hooks:
|
||||||
|
post:
|
||||||
|
- cmd: xz -k -9 {{ .Path }}
|
||||||
|
dir: ./dist/
|
||||||
|
- cmd: sh .goreleaser.checksum.sh {{ .Path }}
|
||||||
|
- cmd: sh .goreleaser.checksum.sh {{ .Path }}.xz
|
||||||
|
|
||||||
|
blobs:
|
||||||
|
-
|
||||||
|
provider: s3
|
||||||
|
bucket: "{{ .Env.S3_BUCKET }}"
|
||||||
|
region: "{{ .Env.S3_REGION }}"
|
||||||
|
folder: "tea/{{.Version}}"
|
||||||
|
extra_files:
|
||||||
|
- glob: ./**.xz
|
||||||
|
- glob: ./**.sha256
|
||||||
|
|
||||||
|
archives:
|
||||||
|
- format: binary
|
||||||
|
name_template: "{{ .Binary }}"
|
||||||
|
allow_different_binary_count: true
|
||||||
|
|
||||||
|
checksum:
|
||||||
|
name_template: 'checksums.txt'
|
||||||
|
extra_files:
|
||||||
|
- glob: ./**.xz
|
||||||
|
|
||||||
|
force_token: gitea
|
||||||
|
|
||||||
|
signs:
|
||||||
|
-
|
||||||
|
signature: "${artifact}.sig"
|
||||||
|
artifacts: checksum
|
||||||
|
stdin: '{{ .Env.GPGSIGN_PASSPHRASE }}'
|
||||||
|
args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
||||||
|
|
||||||
|
snapshot:
|
||||||
|
name_template: "{{ .Branch }}-devel"
|
||||||
|
|
||||||
|
nightly:
|
||||||
|
name_template: "{{ .Branch }}"
|
||||||
|
|
||||||
|
gitea_urls:
|
||||||
|
api: https://gitea.com/api/v1
|
||||||
|
download: https://gitea.com
|
||||||
|
|
||||||
|
release:
|
||||||
|
extra_files:
|
||||||
|
- glob: ./**.xz
|
||||||
|
- glob: ./**.xz.sha256
|
||||||
|
|
||||||
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
|
||||||
|
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
|
@ -1,5 +1,10 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v0.9.1](https://gitea.com/gitea/tea/releases/tag/v0.9.1) - 2023-02-15
|
||||||
|
|
||||||
|
* BUGFIXES
|
||||||
|
* Print pull dont crash if it has TeamReviewRequests (#517)
|
||||||
|
|
||||||
## [v0.9.0](https://gitea.com/gitea/tea/releases/tag/v0.9.0) - 2022-09-13
|
## [v0.9.0](https://gitea.com/gitea/tea/releases/tag/v0.9.0) - 2022-09-13
|
||||||
|
|
||||||
* BREAKING
|
* BREAKING
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
- [Bug reports](#bug-reports)
|
- [Bug reports](#bug-reports)
|
||||||
- [Discuss your design](#discuss-your-design)
|
- [Discuss your design](#discuss-your-design)
|
||||||
- [Testing redux](#testing-redux)
|
- [Testing redux](#testing-redux)
|
||||||
- [Vendoring](#vendoring)
|
|
||||||
- [Code review](#code-review)
|
- [Code review](#code-review)
|
||||||
- [Styleguide](#styleguide)
|
- [Styleguide](#styleguide)
|
||||||
- [Sign-off your work](#sign-off-your-work)
|
- [Sign-off your work](#sign-off-your-work)
|
||||||
|
@ -60,20 +59,6 @@ high-level discussions.
|
||||||
Before sending code out for review, run all the test by executing: `make test`
|
Before sending code out for review, run all the test by executing: `make test`
|
||||||
Since TEA is an cli tool it should be obvious to test your feature locally first.
|
Since TEA is an cli tool it should be obvious to test your feature locally first.
|
||||||
|
|
||||||
## Vendoring
|
|
||||||
|
|
||||||
We keep a cached copy of dependencies within the `vendor/` directory,
|
|
||||||
managing updates via [dep](https://github.com/golang/dep).
|
|
||||||
|
|
||||||
Pull requests should only include `vendor/` updates if they are part of
|
|
||||||
the same change, be it a bugfix or a feature addition.
|
|
||||||
|
|
||||||
The `vendor/` update needs to be justified as part of the PR description,
|
|
||||||
and must be verified by the reviewers and/or merger to always reference
|
|
||||||
an existing upstream commit.
|
|
||||||
|
|
||||||
You can find more information on how to get started with it on the [dep project website](https://golang.github.io/dep/docs/introduction.html).
|
|
||||||
|
|
||||||
## Code review
|
## Code review
|
||||||
|
|
||||||
Changes to TEA must be reviewed before they are accepted—no matter who
|
Changes to TEA must be reviewed before they are accepted—no matter who
|
||||||
|
@ -175,7 +160,7 @@ maintainers](MAINTAINERS). Every PR **MUST** be reviewed by at least
|
||||||
two maintainers (or owners) before it can get merged. A maintainer
|
two maintainers (or owners) before it can get merged. A maintainer
|
||||||
should be a contributor of Gitea (or Gogs) and contributed at least
|
should be a contributor of Gitea (or Gogs) and contributed at least
|
||||||
4 accepted PRs. A contributor should apply as a maintainer in the
|
4 accepted PRs. A contributor should apply as a maintainer in the
|
||||||
[Discord](https://discord.gg/NsatcWJ) #develop channel. The owners
|
[Discord](https://discord.gg/Gitea) #develop channel. The owners
|
||||||
or the team maintainers may invite the contributor. A maintainer
|
or the team maintainers may invite the contributor. A maintainer
|
||||||
should spend some time on code reviews. If a maintainer has no
|
should spend some time on code reviews. If a maintainer has no
|
||||||
time to do that, they should apply to leave the maintainers team
|
time to do that, they should apply to leave the maintainers team
|
||||||
|
@ -208,7 +193,7 @@ https://help.github.com/articles/securing-your-account-with-two-factor-authentic
|
||||||
|
|
||||||
After the election, the new owners should proactively agree
|
After the election, the new owners should proactively agree
|
||||||
with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the
|
with our [CONTRIBUTING](CONTRIBUTING.md) requirements in the
|
||||||
[Discord](https://discord.gg/NsatcWJ) #general channel. Below are the
|
[Discord](https://discord.gg/Gitea) #general channel. Below are the
|
||||||
words to speak:
|
words to speak:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -236,8 +221,8 @@ Code that you contribute should use the standard copyright header:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Files in the repository contain copyright from the year they are added
|
Files in the repository contain copyright from the year they are added
|
||||||
|
|
29
Dockerfile
29
Dockerfile
|
@ -1,25 +1,10 @@
|
||||||
ARG GOVERSION="1.16.2"
|
FROM cgr.dev/chainguard/go:latest AS build
|
||||||
|
COPY . /build/
|
||||||
|
WORKDIR /build
|
||||||
|
RUN make build
|
||||||
|
|
||||||
FROM golang:${GOVERSION}-alpine AS buildenv
|
FROM cgr.dev/chainguard/static:latest
|
||||||
|
COPY --from=build /build/tea /tea
|
||||||
ARG GOOS="linux"
|
VOLUME [ "/app" ]
|
||||||
|
|
||||||
COPY . $GOPATH/src/
|
|
||||||
WORKDIR $GOPATH/src
|
|
||||||
|
|
||||||
RUN apk add --quiet --no-cache \
|
|
||||||
build-base \
|
|
||||||
make \
|
|
||||||
git && \
|
|
||||||
make clean build STATIC=true
|
|
||||||
|
|
||||||
FROM scratch
|
|
||||||
ARG VERSION="0.7.0"
|
|
||||||
LABEL org.opencontainers.image.title="tea - CLI for Gitea - git with a cup of tea"
|
|
||||||
LABEL org.opencontainers.image.description="A command line tool to interact with Gitea servers"
|
|
||||||
LABEL org.opencontainers.image.version="${VERSION}"
|
|
||||||
LABEL org.opencontainers.image.authors="Tamás Gérczei <tamas@gerczei.eu>"
|
|
||||||
LABEL org.opencontainers.image.vendor="The Gitea Authors"
|
|
||||||
COPY --from=buildenv /go/src/tea /
|
|
||||||
ENV HOME="/app"
|
ENV HOME="/app"
|
||||||
ENTRYPOINT ["/tea"]
|
ENTRYPOINT ["/tea"]
|
||||||
|
|
1
LICENSE
1
LICENSE
|
@ -1,5 +1,4 @@
|
||||||
Copyright (c) 2016 The Gitea Authors
|
Copyright (c) 2016 The Gitea Authors
|
||||||
Copyright (c) 2015 The Gogs Authors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
87
Makefile
87
Makefile
|
@ -1,13 +1,10 @@
|
||||||
DIST := dist
|
DIST := dist
|
||||||
export GO111MODULE=on
|
|
||||||
export CGO_ENABLED=0
|
|
||||||
|
|
||||||
GO ?= go
|
GO ?= go
|
||||||
SHASUM ?= shasum -a 256
|
SHASUM ?= shasum -a 256
|
||||||
|
|
||||||
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
|
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
|
||||||
|
|
||||||
GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
|
GOFILES := $(shell find . -name "*.go" -type f ! -path "*/bindata.go")
|
||||||
GOFMT ?= gofmt -s
|
GOFMT ?= gofmt -s
|
||||||
|
|
||||||
ifneq ($(DRONE_TAG),)
|
ifneq ($(DRONE_TAG),)
|
||||||
|
@ -17,7 +14,7 @@ else
|
||||||
ifneq ($(DRONE_BRANCH),)
|
ifneq ($(DRONE_BRANCH),)
|
||||||
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
|
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
|
||||||
else
|
else
|
||||||
VERSION ?= master
|
VERSION ?= main
|
||||||
endif
|
endif
|
||||||
TEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
TEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
||||||
endif
|
endif
|
||||||
|
@ -28,19 +25,18 @@ SDK ?= $(shell $(GO) list -f '{{.Version}}' -m code.gitea.io/sdk/gitea)
|
||||||
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.SDK=$(SDK)" -s -w
|
LDFLAGS := -X "main.Version=$(TEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.SDK=$(SDK)" -s -w
|
||||||
|
|
||||||
# override to allow passing additional goflags via make CLI
|
# override to allow passing additional goflags via make CLI
|
||||||
override GOFLAGS := $(GOFLAGS) -mod=vendor -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
override GOFLAGS := $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)'
|
||||||
|
|
||||||
PACKAGES ?= $(shell $(GO) list ./... | grep -v /vendor/)
|
PACKAGES ?= $(shell $(GO) list ./...)
|
||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
|
|
||||||
# OS specific vars.
|
# OS specific vars.
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
EXECUTABLE := tea.exe
|
EXECUTABLE := tea.exe
|
||||||
|
VET_TOOL := gitea-vet.exe
|
||||||
else
|
else
|
||||||
EXECUTABLE := tea
|
EXECUTABLE := tea
|
||||||
ifneq ($(shell uname -s), OpenBSD)
|
VET_TOOL := gitea-vet
|
||||||
override BUILDMODE := -buildmode=pie
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
@ -48,7 +44,7 @@ all: build
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(GO) clean -mod=vendor -i ./...
|
$(GO) clean -i ./...
|
||||||
rm -rf $(EXECUTABLE) $(DIST)
|
rm -rf $(EXECUTABLE) $(DIST)
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
|
@ -58,22 +54,22 @@ fmt:
|
||||||
.PHONY: vet
|
.PHONY: vet
|
||||||
vet:
|
vet:
|
||||||
# Default vet
|
# Default vet
|
||||||
$(GO) vet -mod=vendor $(PACKAGES)
|
$(GO) vet $(PACKAGES)
|
||||||
# Custom vet
|
# Custom vet
|
||||||
$(GO) build -mod=vendor code.gitea.io/gitea-vet
|
$(GO) build code.gitea.io/gitea-vet
|
||||||
$(GO) vet -vettool=gitea-vet $(PACKAGES)
|
$(GO) vet -vettool=$(VET_TOOL) $(PACKAGES)
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: install-lint-tools
|
lint: install-lint-tools
|
||||||
revive -config .revive.toml -exclude=./vendor/... ./... || exit 1
|
$(GO) run github.com/mgechev/revive@v1.3.2 -config .revive.toml ./... || exit 1
|
||||||
|
|
||||||
.PHONY: misspell-check
|
.PHONY: misspell-check
|
||||||
misspell-check: install-lint-tools
|
misspell-check: install-lint-tools
|
||||||
misspell -error -i unknwon,destory $(GOFILES)
|
$(GO) run github.com/client9/misspell/cmd/misspell@latest -error -i unknwon,destory $(GOFILES)
|
||||||
|
|
||||||
.PHONY: misspell
|
.PHONY: misspell
|
||||||
misspell: install-lint-tools
|
misspell: install-lint-tools
|
||||||
misspell -w -i unknwon $(GOFILES)
|
$(GO) run github.com/client9/misspell/cmd/misspell@latest -w -i unknwon $(GOFILES)
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
fmt-check:
|
fmt-check:
|
||||||
|
@ -85,25 +81,38 @@ fmt-check:
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
.PHONY: docs
|
||||||
|
docs:
|
||||||
|
$(GO) run . docs --out docs/CLI.md
|
||||||
|
|
||||||
|
.PHONY: docs-check
|
||||||
|
docs-check:
|
||||||
|
@DIFF=$$($(GO) run . docs | diff docs/CLI.md -); \
|
||||||
|
if [ -n "$$DIFF" ]; then \
|
||||||
|
echo "Please run 'make docs' and commit the result:"; \
|
||||||
|
echo "$$DIFF"; \
|
||||||
|
exit 1; \
|
||||||
|
fi;
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
|
$(GO) test -tags='sqlite sqlite_unlock_notify' $(PACKAGES)
|
||||||
|
|
||||||
.PHONY: unit-test-coverage
|
.PHONY: unit-test-coverage
|
||||||
unit-test-coverage:
|
unit-test-coverage:
|
||||||
$(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
$(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
||||||
|
|
||||||
.PHONY: vendor
|
.PHONY: tidy
|
||||||
vendor:
|
tidy:
|
||||||
$(GO) mod tidy && $(GO) mod vendor
|
$(GO) mod tidy
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: test
|
check: test
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(SOURCES)
|
install: $(SOURCES)
|
||||||
@echo "installing to $(GOPATH)/bin/$(EXECUTABLE)"
|
@echo "installing to $(shell $(GO) env GOPATH)/bin/$(EXECUTABLE)"
|
||||||
$(GO) install -v $(BUILDMODE) $(GOFLAGS)
|
$(GO) install -v $(BUILDMODE) $(GOFLAGS)
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(EXECUTABLE)
|
build: $(EXECUTABLE)
|
||||||
|
@ -115,37 +124,9 @@ $(EXECUTABLE): $(SOURCES)
|
||||||
build-image:
|
build-image:
|
||||||
docker build --build-arg VERSION=$(TEA_VERSION) -t gitea/tea:$(TEA_VERSION_TAG) .
|
docker build --build-arg VERSION=$(TEA_VERSION) -t gitea/tea:$(TEA_VERSION_TAG) .
|
||||||
|
|
||||||
.PHONY: release
|
|
||||||
release: release-dirs install-release-tools release-os release-compress release-check
|
|
||||||
|
|
||||||
.PHONY: release-dirs
|
|
||||||
release-dirs:
|
|
||||||
mkdir -p $(DIST)/binaries $(DIST)/release
|
|
||||||
|
|
||||||
.PHONY: release-os
|
|
||||||
release-os:
|
|
||||||
CGO_ENABLED=0 gox -verbose -cgo=false $(GOFLAGS) -osarch='!darwin/386 !darwin/arm' -os="windows linux darwin" -arch="386 amd64 arm arm64" -output="$(DIST)/release/tea-$(VERSION)-{{.OS}}-{{.Arch}}"
|
|
||||||
|
|
||||||
.PHONY: release-compress
|
|
||||||
release-compress: install-release-tools
|
|
||||||
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
|
|
||||||
|
|
||||||
.PHONY: release-check
|
|
||||||
release-check: install-release-tools
|
|
||||||
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
|
|
||||||
|
|
||||||
### tools
|
|
||||||
install-release-tools:
|
|
||||||
@hash gox > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) install github.com/mitchellh/gox@latest; \
|
|
||||||
fi
|
|
||||||
@hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
|
||||||
$(GO) install github.com/ulikunitz/xz/cmd/gxz@latest; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
install-lint-tools:
|
install-lint-tools:
|
||||||
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
@hash revive > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
$(GO) install github.com/mgechev/revive@latest; \
|
$(GO) install github.com/mgechev/revive@v1.3.2; \
|
||||||
fi
|
fi
|
||||||
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
@hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
$(GO) install github.com/client9/misspell/cmd/misspell@latest; \
|
$(GO) install github.com/client9/misspell/cmd/misspell@latest; \
|
||||||
|
|
51
README.md
51
README.md
|
@ -1,8 +1,12 @@
|
||||||
# <img alt='' src='https://gitea.com/repo-avatars/550-80a3a8c2ab0e2c2d69f296b7f8582485' height="40"/> *T E A*
|
# <img alt='tea logo' src='https://gitea.com/repo-avatars/550-80a3a8c2ab0e2c2d69f296b7f8582485' height="40"/> *T E A*
|
||||||
|
|
||||||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Release](https://raster.shields.io/badge/dynamic/json.svg?label=release&url=https://gitea.com/api/v1/repos/gitea/tea/releases&query=$[0].tag_name)](https://gitea.com/gitea/tea/releases) [![Build Status](https://drone.gitea.com/api/badges/gitea/tea/status.svg)](https://drone.gitea.com/gitea/tea) [![Join the chat at https://img.shields.io/discord/322538954119184384.svg](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea) [![Go Report Card](https://goreportcard.com/badge/code.gitea.io/tea)](https://goreportcard.com/report/code.gitea.io/tea) [![GoDoc](https://godoc.org/code.gitea.io/tea?status.svg)](https://godoc.org/code.gitea.io/tea)
|
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
|
||||||
|
[![Release](https://raster.shields.io/badge/dynamic/json.svg?label=release&url=https://gitea.com/api/v1/repos/gitea/tea/releases&query=$[0].tag_name)](https://gitea.com/gitea/tea/releases)
|
||||||
|
[![Join the chat at https://img.shields.io/discord/322538954119184384.svg](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/Gitea)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/tea)](https://goreportcard.com/report/code.gitea.io/tea) [![GoDoc](https://pkg.go.dev/badge/code.gitea.io/tea?status.svg)](https://godoc.org/code.gitea.io/tea)
|
||||||
|
![Tea Release Status](https://gitea.com/gitea/tea/actions/workflows/release-nightly.yml/badge.svg)
|
||||||
|
|
||||||
### The official CLI for Gitea
|
## The official CLI for Gitea
|
||||||
|
|
||||||
![demo gif](./demo.gif)
|
![demo gif](./demo.gif)
|
||||||
|
|
||||||
|
@ -25,15 +29,16 @@
|
||||||
COMMANDS
|
COMMANDS
|
||||||
help, h Shows a list of commands or help for one command
|
help, h Shows a list of commands or help for one command
|
||||||
ENTITIES:
|
ENTITIES:
|
||||||
issues, issue, i List, create and update issues
|
issues, issue, i List, create and update issues
|
||||||
pulls, pull, pr Manage and checkout pull requests
|
pulls, pull, pr Manage and checkout pull requests
|
||||||
labels, label Manage issue labels
|
labels, label Manage issue labels
|
||||||
milestones, milestone, ms List and create milestones
|
milestones, milestone, ms List and create milestones
|
||||||
releases, release, r Manage releases
|
releases, release, r Manage releases
|
||||||
times, time, t Operate on tracked times of a repository's issues & pulls
|
release assets, release asset, r a Manage release attachments
|
||||||
organizations, organization, org List, create, delete organizations
|
times, time, t Operate on tracked times of a repository's issues & pulls
|
||||||
repos, repo Show repository details
|
organizations, organization, org List, create, delete organizations
|
||||||
comment, c Add a comment to an issue / pr
|
repos, repo Show repository details
|
||||||
|
comment, c Add a comment to an issue / pr
|
||||||
HELPERS:
|
HELPERS:
|
||||||
open, o Open something of the repository in web browser
|
open, o Open something of the repository in web browser
|
||||||
notifications, notification, n Show notifications
|
notifications, notification, n Show notifications
|
||||||
|
@ -69,7 +74,7 @@
|
||||||
ABOUT
|
ABOUT
|
||||||
Written & maintained by The Gitea Authors.
|
Written & maintained by The Gitea Authors.
|
||||||
If you find a bug or want to contribute, we'll welcome you at https://gitea.com/gitea/tea.
|
If you find a bug or want to contribute, we'll welcome you at https://gitea.com/gitea/tea.
|
||||||
More info about Gitea itself on https://gitea.io.
|
More info about Gitea itself on https://about.gitea.com.
|
||||||
```
|
```
|
||||||
|
|
||||||
- [Compare features with other git forge CLIs](./FEATURE-COMPARISON.md)
|
- [Compare features with other git forge CLIs](./FEATURE-COMPARISON.md)
|
||||||
|
@ -80,20 +85,22 @@
|
||||||
There are different ways to get `tea`:
|
There are different ways to get `tea`:
|
||||||
|
|
||||||
1. Install via your system package manager:
|
1. Install via your system package manager:
|
||||||
- macOS via `brew` (gitea-maintained):
|
- macOS via `brew` (official):
|
||||||
```sh
|
```sh
|
||||||
brew tap gitea/tap https://gitea.com/gitea/homebrew-gitea
|
|
||||||
brew install tea
|
brew install tea
|
||||||
```
|
```
|
||||||
- arch linux ([gitea-tea-git](https://aur.archlinux.org/packages/gitea-tea-git), thirdparty)
|
- arch linux ([gitea-tea-git](https://aur.archlinux.org/packages/gitea-tea-git), thirdparty)
|
||||||
- alpine linux ([tea](https://pkgs.alpinelinux.org/packages?name=tea&branch=edge), thirdparty)
|
- alpine linux ([tea](https://pkgs.alpinelinux.org/packages?name=tea&branch=edge), thirdparty)
|
||||||
|
- Windows via `MSYS2` ([tea](https://packages.msys2.org/base/mingw-w64-tea), thirdparty)
|
||||||
|
|
||||||
2. Use the prebuilt binaries from [dl.gitea.io](https://dl.gitea.io/tea/)
|
2. Use the prebuilt binaries from [dl.gitea.com](https://dl.gitea.com/tea/)
|
||||||
|
|
||||||
3. Install from source: [see *Compilation*](#compilation)
|
3. Install from source: [see *Compilation*](#compilation)
|
||||||
|
|
||||||
4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea)
|
4. Docker (thirdparty): [tgerczei/tea](https://hub.docker.com/r/tgerczei/tea)
|
||||||
|
|
||||||
|
5. asdf (thirdparty): [mvaldes14/asdf-tea](https://github.com/mvaldes14/asdf-tea)
|
||||||
|
|
||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
Make sure you have a current go version installed (1.13 or newer).
|
Make sure you have a current go version installed (1.13 or newer).
|
||||||
|
@ -105,10 +112,15 @@ Make sure you have a current go version installed (1.13 or newer).
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
Note that GNU Make (gmake on OpenBSD) is required.
|
Note that GNU Make (gmake on OpenBSD) is required.
|
||||||
|
If you want to install the compiled program you have to execute the following command:
|
||||||
- For a quick installation without `git` & `make`:
|
|
||||||
```sh
|
```sh
|
||||||
go install code.gitea.io/tea@latest
|
make install
|
||||||
|
```
|
||||||
|
This installs the binary into the "bin" folder inside of your GOPATH folder (`go env GOPATH`). It is possible that this folder isn't in your PATH Environment Variable.
|
||||||
|
|
||||||
|
- For a quick installation without `git` & `make`, set $version and exec:
|
||||||
|
```sh
|
||||||
|
go install code.gitea.io/tea@${version}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
@ -117,7 +129,6 @@ Fork -> Patch -> Push -> Pull Request
|
||||||
|
|
||||||
- `make test` run testsuite
|
- `make test` run testsuite
|
||||||
- `make vet` run checks (check the order of imports; preventing failure on CI pipeline beforehand)
|
- `make vet` run checks (check the order of imports; preventing failure on CI pipeline beforehand)
|
||||||
- `make vendor` when adding new dependencies
|
|
||||||
- ... (for other development tasks, check the `Makefile`)
|
- ... (for other development tasks, check the `Makefile`)
|
||||||
|
|
||||||
**Please** read the [CONTRIBUTING](CONTRIBUTING.md) documentation, it will tell you about internal structures and concepts.
|
**Please** read the [CONTRIBUTING](CONTRIBUTING.md) documentation, it will tell you about internal structures and concepts.
|
||||||
|
|
4
build.go
4
build.go
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
//go:build vendor
|
//go:build vendor
|
||||||
// +build vendor
|
// +build vendor
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package users
|
package users
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.gitea.io/tea/cmd/attachments"
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdReleaseAttachments represents a release attachment (file attachment)
|
||||||
|
var CmdReleaseAttachments = cli.Command{
|
||||||
|
Name: "assets",
|
||||||
|
Aliases: []string{"asset", "a"},
|
||||||
|
Category: catEntities,
|
||||||
|
Usage: "Manage release assets",
|
||||||
|
Description: "Manage release assets",
|
||||||
|
ArgsUsage: " ", // command does not accept arguments
|
||||||
|
Action: attachments.RunReleaseAttachmentList,
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
&attachments.CmdReleaseAttachmentList,
|
||||||
|
&attachments.CmdReleaseAttachmentCreate,
|
||||||
|
&attachments.CmdReleaseAttachmentDelete,
|
||||||
|
},
|
||||||
|
Flags: flags.AllDefaultFlags,
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package attachments
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdReleaseAttachmentCreate represents a sub command of Release Attachments to create a release attachment
|
||||||
|
var CmdReleaseAttachmentCreate = cli.Command{
|
||||||
|
Name: "create",
|
||||||
|
Aliases: []string{"c"},
|
||||||
|
Usage: "Create one or more release attachments",
|
||||||
|
Description: `Create one or more release attachments`,
|
||||||
|
ArgsUsage: "<release-tag> <asset> [<asset>...]",
|
||||||
|
Action: runReleaseAttachmentCreate,
|
||||||
|
Flags: flags.AllDefaultFlags,
|
||||||
|
}
|
||||||
|
|
||||||
|
func runReleaseAttachmentCreate(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
|
if ctx.Args().Len() < 2 {
|
||||||
|
return fmt.Errorf("No release tag or assets specified.\nUsage:\t%s", ctx.Command.UsageText)
|
||||||
|
}
|
||||||
|
|
||||||
|
tag := ctx.Args().First()
|
||||||
|
if len(tag) == 0 {
|
||||||
|
return fmt.Errorf("Release tag needed to create attachment")
|
||||||
|
}
|
||||||
|
|
||||||
|
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, asset := range ctx.Args().Slice()[1:] {
|
||||||
|
var file *os.File
|
||||||
|
if file, err = os.Open(asset); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
filePath := filepath.Base(asset)
|
||||||
|
|
||||||
|
if _, _, err = ctx.Login.Client().CreateReleaseAttachment(ctx.Owner, ctx.Repo, release.ID, file, filePath); err != nil {
|
||||||
|
file.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
file.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package attachments
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdReleaseAttachmentDelete represents a sub command of Release Attachments to delete a release attachment
|
||||||
|
var CmdReleaseAttachmentDelete = cli.Command{
|
||||||
|
Name: "delete",
|
||||||
|
Aliases: []string{"rm"},
|
||||||
|
Usage: "Delete one or more release attachments",
|
||||||
|
Description: `Delete one or more release attachments`,
|
||||||
|
ArgsUsage: "<release tag> <attachment name> [<attachment name>...]",
|
||||||
|
Action: runReleaseAttachmentDelete,
|
||||||
|
Flags: append([]cli.Flag{
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "confirm",
|
||||||
|
Aliases: []string{"y"},
|
||||||
|
Usage: "Confirm deletion (required)",
|
||||||
|
},
|
||||||
|
}, flags.AllDefaultFlags...),
|
||||||
|
}
|
||||||
|
|
||||||
|
func runReleaseAttachmentDelete(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
|
if ctx.Args().Len() < 2 {
|
||||||
|
return fmt.Errorf("No release tag or attachment names specified.\nUsage:\t%s", ctx.Command.UsageText)
|
||||||
|
}
|
||||||
|
|
||||||
|
tag := ctx.Args().First()
|
||||||
|
if len(tag) == 0 {
|
||||||
|
return fmt.Errorf("Release tag needed to delete attachment")
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ctx.Bool("confirm") {
|
||||||
|
fmt.Println("Are you sure? Please confirm with -y or --confirm.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
existing, _, err := client.ListReleaseAttachments(ctx.Owner, ctx.Repo, release.ID, gitea.ListReleaseAttachmentsOptions{
|
||||||
|
ListOptions: gitea.ListOptions{Page: -1},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name := range ctx.Args().Slice()[1:] {
|
||||||
|
var attachment *gitea.Attachment
|
||||||
|
for _, a := range existing {
|
||||||
|
if a.Name == name {
|
||||||
|
attachment = a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if attachment == nil {
|
||||||
|
return fmt.Errorf("Release does not have attachment named '%s'", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = client.DeleteReleaseAttachment(ctx.Owner, ctx.Repo, release.ID, attachment.ID)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getReleaseAttachmentByName(owner, repo string, release int64, name string, client *gitea.Client) (*gitea.Attachment, error) {
|
||||||
|
al, _, err := client.ListReleaseAttachments(owner, repo, release, gitea.ListReleaseAttachmentsOptions{
|
||||||
|
ListOptions: gitea.ListOptions{Page: -1},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(al) == 0 {
|
||||||
|
return nil, fmt.Errorf("Release does not have any attachments")
|
||||||
|
}
|
||||||
|
for _, a := range al {
|
||||||
|
if a.Name == name {
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("Attachment does not exist")
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package attachments
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/print"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdReleaseAttachmentList represents a sub command of release attachment to list release attachments
|
||||||
|
var CmdReleaseAttachmentList = cli.Command{
|
||||||
|
Name: "list",
|
||||||
|
Aliases: []string{"ls"},
|
||||||
|
Usage: "List Release Attachments",
|
||||||
|
Description: "List Release Attachments",
|
||||||
|
ArgsUsage: "<release-tag>", // command does not accept arguments
|
||||||
|
Action: RunReleaseAttachmentList,
|
||||||
|
Flags: append([]cli.Flag{
|
||||||
|
&flags.PaginationPageFlag,
|
||||||
|
&flags.PaginationLimitFlag,
|
||||||
|
}, flags.AllDefaultFlags...),
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunReleaseAttachmentList list release attachments
|
||||||
|
func RunReleaseAttachmentList(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
|
tag := ctx.Args().First()
|
||||||
|
if len(tag) == 0 {
|
||||||
|
return fmt.Errorf("Release tag needed to list attachments")
|
||||||
|
}
|
||||||
|
|
||||||
|
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
attachments, _, err := ctx.Login.Client().ListReleaseAttachments(ctx.Owner, ctx.Repo, release.ID, gitea.ListReleaseAttachmentsOptions{
|
||||||
|
ListOptions: ctx.GetListOptions(),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
print.ReleaseAttachmentsList(attachments, ctx.Output)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getReleaseByTag(owner, repo, tag string, client *gitea.Client) (*gitea.Release, error) {
|
||||||
|
rl, _, err := client.ListReleases(owner, repo, gitea.ListReleasesOptions{
|
||||||
|
ListOptions: gitea.ListOptions{Page: -1},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(rl) == 0 {
|
||||||
|
return nil, fmt.Errorf("Repo does not have any release")
|
||||||
|
}
|
||||||
|
for _, r := range rl {
|
||||||
|
if r.TagName == tag {
|
||||||
|
return r, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("Release tag does not exist")
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.gitea.io/tea/cmd/branches"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdBranches represents to login a gitea server.
|
||||||
|
var CmdBranches = cli.Command{
|
||||||
|
Name: "branches",
|
||||||
|
Aliases: []string{"branch", "b"},
|
||||||
|
Category: catEntities,
|
||||||
|
Usage: "Consult branches",
|
||||||
|
Description: `Lists branches when called without argument. If a branch is provided, will show it in detail.`,
|
||||||
|
ArgsUsage: "[<branch name>]",
|
||||||
|
Action: runBranches,
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
&branches.CmdBranchesList,
|
||||||
|
&branches.CmdBranchesProtect,
|
||||||
|
&branches.CmdBranchesUnprotect,
|
||||||
|
},
|
||||||
|
Flags: append([]cli.Flag{
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "comments",
|
||||||
|
Usage: "Whether to display comments (will prompt if not provided & run interactively)",
|
||||||
|
},
|
||||||
|
}, branches.CmdBranchesList.Flags...),
|
||||||
|
}
|
||||||
|
|
||||||
|
func runBranches(ctx *cli.Context) error {
|
||||||
|
return branches.RunBranchesList(ctx)
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package branches
|
||||||
|
|
||||||
|
import (
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/print"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var branchFieldsFlag = flags.FieldsFlag(print.BranchFields, []string{
|
||||||
|
"name", "protected", "user-can-merge", "user-can-push",
|
||||||
|
})
|
||||||
|
|
||||||
|
// CmdBranchesListFlags Flags for command list
|
||||||
|
var CmdBranchesListFlags = append([]cli.Flag{
|
||||||
|
branchFieldsFlag,
|
||||||
|
&flags.PaginationPageFlag,
|
||||||
|
&flags.PaginationLimitFlag,
|
||||||
|
}, flags.AllDefaultFlags...)
|
||||||
|
|
||||||
|
// CmdBranchesList represents a sub command of branches to list branches
|
||||||
|
var CmdBranchesList = cli.Command{
|
||||||
|
Name: "list",
|
||||||
|
Aliases: []string{"ls"},
|
||||||
|
Usage: "List branches of the repository",
|
||||||
|
Description: `List branches of the repository`,
|
||||||
|
ArgsUsage: " ", // command does not accept arguments
|
||||||
|
Action: RunBranchesList,
|
||||||
|
Flags: CmdBranchesListFlags,
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunBranchesList list branches
|
||||||
|
func RunBranchesList(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
|
||||||
|
owner := ctx.Owner
|
||||||
|
if ctx.IsSet("owner") {
|
||||||
|
owner = ctx.String("owner")
|
||||||
|
}
|
||||||
|
|
||||||
|
var branches []*gitea.Branch
|
||||||
|
var protections []*gitea.BranchProtection
|
||||||
|
var err error
|
||||||
|
branches, _, err = ctx.Login.Client().ListRepoBranches(owner, ctx.Repo, gitea.ListRepoBranchesOptions{
|
||||||
|
ListOptions: ctx.GetListOptions(),
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
protections, _, err = ctx.Login.Client().ListBranchProtections(owner, ctx.Repo, gitea.ListBranchProtectionsOptions{
|
||||||
|
ListOptions: ctx.GetListOptions(),
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fields, err := branchFieldsFlag.GetValues(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
print.BranchesList(branches, protections, ctx.Output, fields)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -0,0 +1,101 @@
|
||||||
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package branches
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdBranchesProtectFlags Flags for command protect/unprotect
|
||||||
|
var CmdBranchesProtectFlags = append([]cli.Flag{
|
||||||
|
branchFieldsFlag,
|
||||||
|
&flags.PaginationPageFlag,
|
||||||
|
&flags.PaginationLimitFlag,
|
||||||
|
}, flags.AllDefaultFlags...)
|
||||||
|
|
||||||
|
// CmdBranchesProtect represents a sub command of branches to protect a branch
|
||||||
|
var CmdBranchesProtect = cli.Command{
|
||||||
|
Name: "protect",
|
||||||
|
Aliases: []string{"P"},
|
||||||
|
Usage: "Protect branches",
|
||||||
|
Description: `Block actions push/merge on specified branches`,
|
||||||
|
ArgsUsage: "<branch>",
|
||||||
|
Action: RunBranchesProtect,
|
||||||
|
Flags: CmdBranchesProtectFlags,
|
||||||
|
}
|
||||||
|
|
||||||
|
// CmdBranchesUnprotect represents a sub command of branches to protect a branch
|
||||||
|
var CmdBranchesUnprotect = cli.Command{
|
||||||
|
Name: "unprotect",
|
||||||
|
Aliases: []string{"U"},
|
||||||
|
Usage: "Unprotect branches",
|
||||||
|
Description: `Suppress existing protections on specified branches`,
|
||||||
|
ArgsUsage: "<branch>",
|
||||||
|
Action: RunBranchesProtect,
|
||||||
|
Flags: CmdBranchesProtectFlags,
|
||||||
|
}
|
||||||
|
|
||||||
|
// RunBranchesProtect function to protect/unprotect a list of branches
|
||||||
|
func RunBranchesProtect(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
|
||||||
|
if !cmd.Args().Present() {
|
||||||
|
return fmt.Errorf("must specify at least one branch")
|
||||||
|
}
|
||||||
|
|
||||||
|
owner := ctx.Owner
|
||||||
|
if ctx.IsSet("owner") {
|
||||||
|
owner = ctx.String("owner")
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, branch := range ctx.Args().Slice() {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
command := ctx.Command.Name
|
||||||
|
if command == "protect" {
|
||||||
|
_, _, err = ctx.Login.Client().CreateBranchProtection(owner, ctx.Repo, gitea.CreateBranchProtectionOption{
|
||||||
|
BranchName: branch,
|
||||||
|
RuleName: "",
|
||||||
|
EnablePush: false,
|
||||||
|
EnablePushWhitelist: false,
|
||||||
|
PushWhitelistUsernames: []string{},
|
||||||
|
PushWhitelistTeams: []string{},
|
||||||
|
PushWhitelistDeployKeys: false,
|
||||||
|
EnableMergeWhitelist: false,
|
||||||
|
MergeWhitelistUsernames: []string{},
|
||||||
|
MergeWhitelistTeams: []string{},
|
||||||
|
EnableStatusCheck: false,
|
||||||
|
StatusCheckContexts: []string{},
|
||||||
|
RequiredApprovals: 1,
|
||||||
|
EnableApprovalsWhitelist: false,
|
||||||
|
ApprovalsWhitelistUsernames: []string{},
|
||||||
|
ApprovalsWhitelistTeams: []string{},
|
||||||
|
BlockOnRejectedReviews: false,
|
||||||
|
BlockOnOfficialReviewRequests: false,
|
||||||
|
BlockOnOutdatedBranch: false,
|
||||||
|
DismissStaleApprovals: false,
|
||||||
|
RequireSignedCommits: false,
|
||||||
|
ProtectedFilePatterns: "",
|
||||||
|
UnprotectedFilePatterns: "",
|
||||||
|
})
|
||||||
|
} else if command == "unprotect" {
|
||||||
|
_, err = ctx.Login.Client().DeleteBranchProtection(owner, ctx.Repo, branch)
|
||||||
|
} else {
|
||||||
|
return fmt.Errorf("command %s is not supported", command)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/tea/cmd/flags"
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
@ -50,7 +49,7 @@ func runAddComment(cmd *cli.Context) error {
|
||||||
body := strings.Join(ctx.Args().Tail(), " ")
|
body := strings.Join(ctx.Args().Tail(), " ")
|
||||||
if interact.IsStdinPiped() {
|
if interact.IsStdinPiped() {
|
||||||
// custom solution until https://github.com/AlecAivazis/survey/issues/328 is fixed
|
// custom solution until https://github.com/AlecAivazis/survey/issues/328 is fixed
|
||||||
if bodyStdin, err := ioutil.ReadAll(ctx.App.Reader); err != nil {
|
if bodyStdin, err := io.ReadAll(ctx.App.Reader); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if len(bodyStdin) != 0 {
|
} else if len(bodyStdin) != 0 {
|
||||||
body = strings.Join([]string{body, string(bodyStdin)}, "\n\n")
|
body = strings.Join([]string{body, string(bodyStdin)}, "\n\n")
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdDocs generates markdown for tea
|
||||||
|
var CmdDocs = cli.Command{
|
||||||
|
Name: "docs",
|
||||||
|
Hidden: true,
|
||||||
|
Description: "Generate CLI docs",
|
||||||
|
Action: runDocs,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "out",
|
||||||
|
Usage: "Path to output docs to, otherwise prints to stdout",
|
||||||
|
Aliases: []string{"o"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func runDocs(ctx *cli.Context) error {
|
||||||
|
md, err := ctx.App.ToMarkdown()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
outPath := ctx.String("out")
|
||||||
|
if outPath == "" {
|
||||||
|
fmt.Print(md)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(filepath.Dir(outPath), os.ModePerm); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fi, err := os.Create(outPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer fi.Close()
|
||||||
|
if _, err := fi.WriteString(md); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package flags
|
package flags
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package flags
|
package flags
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ var RemoteFlag = cli.StringFlag{
|
||||||
var OutputFlag = cli.StringFlag{
|
var OutputFlag = cli.StringFlag{
|
||||||
Name: "output",
|
Name: "output",
|
||||||
Aliases: []string{"o"},
|
Aliases: []string{"o"},
|
||||||
Usage: "Output format. (csv, simple, table, tsv, yaml)",
|
Usage: "Output format. (simple, table, csv, tsv, yaml, json)",
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaginationPageFlag provides flag for pagination options
|
// PaginationPageFlag provides flag for pagination options
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package flags
|
package flags
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"code.gitea.io/sdk/gitea"
|
"code.gitea.io/sdk/gitea"
|
||||||
"code.gitea.io/tea/modules/context"
|
"code.gitea.io/tea/modules/context"
|
||||||
|
@ -70,6 +70,10 @@ var IssueListingFlags = append([]cli.Flag{
|
||||||
Name: "mentions",
|
Name: "mentions",
|
||||||
Aliases: []string{"M"},
|
Aliases: []string{"M"},
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "owner",
|
||||||
|
Aliases: []string{"org"},
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "from",
|
Name: "from",
|
||||||
Aliases: []string{"F"},
|
Aliases: []string{"F"},
|
||||||
|
@ -84,8 +88,8 @@ var IssueListingFlags = append([]cli.Flag{
|
||||||
&PaginationLimitFlag,
|
&PaginationLimitFlag,
|
||||||
}, AllDefaultFlags...)
|
}, AllDefaultFlags...)
|
||||||
|
|
||||||
// IssuePREditFlags defines flags for properties of issues and PRs
|
// issuePRFlags defines shared flags between flags IssuePRCreateFlags and IssuePREditFlags
|
||||||
var IssuePREditFlags = append([]cli.Flag{
|
var issuePRFlags = append([]cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "title",
|
Name: "title",
|
||||||
Aliases: []string{"t"},
|
Aliases: []string{"t"},
|
||||||
|
@ -94,6 +98,25 @@ var IssuePREditFlags = append([]cli.Flag{
|
||||||
Name: "description",
|
Name: "description",
|
||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "referenced-version",
|
||||||
|
Aliases: []string{"v"},
|
||||||
|
Usage: "commit-hash or tag name to assign",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "milestone",
|
||||||
|
Aliases: []string{"m"},
|
||||||
|
Usage: "Milestone to assign",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "deadline",
|
||||||
|
Aliases: []string{"D"},
|
||||||
|
Usage: "Deadline timestamp to assign",
|
||||||
|
},
|
||||||
|
}, LoginRepoFlags...)
|
||||||
|
|
||||||
|
// IssuePRCreateFlags defines flags for creation of issues and PRs
|
||||||
|
var IssuePRCreateFlags = append([]cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "assignees",
|
Name: "assignees",
|
||||||
Aliases: []string{"a"},
|
Aliases: []string{"a"},
|
||||||
|
@ -104,20 +127,10 @@ var IssuePREditFlags = append([]cli.Flag{
|
||||||
Aliases: []string{"L"},
|
Aliases: []string{"L"},
|
||||||
Usage: "Comma-separated list of labels to assign",
|
Usage: "Comma-separated list of labels to assign",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
}, issuePRFlags...)
|
||||||
Name: "deadline",
|
|
||||||
Aliases: []string{"D"},
|
|
||||||
Usage: "Deadline timestamp to assign",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "milestone",
|
|
||||||
Aliases: []string{"m"},
|
|
||||||
Usage: "Milestone to assign",
|
|
||||||
},
|
|
||||||
}, LoginRepoFlags...)
|
|
||||||
|
|
||||||
// GetIssuePREditFlags parses all IssuePREditFlags
|
// GetIssuePRCreateFlags parses all IssuePREditFlags
|
||||||
func GetIssuePREditFlags(ctx *context.TeaContext) (*gitea.CreateIssueOption, error) {
|
func GetIssuePRCreateFlags(ctx *context.TeaContext) (*gitea.CreateIssueOption, error) {
|
||||||
opts := gitea.CreateIssueOption{
|
opts := gitea.CreateIssueOption{
|
||||||
Title: ctx.String("title"),
|
Title: ctx.String("title"),
|
||||||
Body: ctx.String("description"),
|
Body: ctx.String("description"),
|
||||||
|
@ -159,3 +172,67 @@ func GetIssuePREditFlags(ctx *context.TeaContext) (*gitea.CreateIssueOption, err
|
||||||
|
|
||||||
return &opts, nil
|
return &opts, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IssuePREditFlags defines flags for editing properties of issues and PRs
|
||||||
|
var IssuePREditFlags = append([]cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "add-assignees",
|
||||||
|
Aliases: []string{"a"},
|
||||||
|
Usage: "Comma-separated list of usernames to assign",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "add-labels",
|
||||||
|
Aliases: []string{"L"},
|
||||||
|
Usage: "Comma-separated list of labels to assign. Takes precedence over --remove-labels",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "remove-labels",
|
||||||
|
Usage: "Comma-separated list of labels to remove",
|
||||||
|
},
|
||||||
|
}, issuePRFlags...)
|
||||||
|
|
||||||
|
// GetIssuePREditFlags parses all IssuePREditFlags
|
||||||
|
func GetIssuePREditFlags(ctx *context.TeaContext) (*task.EditIssueOption, error) {
|
||||||
|
opts := task.EditIssueOption{}
|
||||||
|
if ctx.IsSet("title") {
|
||||||
|
val := ctx.String("title")
|
||||||
|
opts.Title = &val
|
||||||
|
}
|
||||||
|
if ctx.IsSet("description") {
|
||||||
|
val := ctx.String("description")
|
||||||
|
opts.Body = &val
|
||||||
|
}
|
||||||
|
if ctx.IsSet("referenced-version") {
|
||||||
|
val := ctx.String("referenced-version")
|
||||||
|
opts.Ref = &val
|
||||||
|
}
|
||||||
|
if ctx.IsSet("milestone") {
|
||||||
|
val := ctx.String("milestone")
|
||||||
|
opts.Milestone = &val
|
||||||
|
}
|
||||||
|
if ctx.IsSet("deadline") {
|
||||||
|
date := ctx.String("deadline")
|
||||||
|
if date == "" {
|
||||||
|
opts.Deadline = &time.Time{}
|
||||||
|
} else {
|
||||||
|
t, err := dateparse.ParseAny(date)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
opts.Deadline = &t
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ctx.IsSet("add-assignees") {
|
||||||
|
val := ctx.String("add-assignees")
|
||||||
|
opts.AddAssignees = strings.Split(val, ",")
|
||||||
|
}
|
||||||
|
if ctx.IsSet("add-labels") {
|
||||||
|
val := ctx.String("add-labels")
|
||||||
|
opts.AddLabels = strings.Split(val, ",")
|
||||||
|
}
|
||||||
|
if ctx.IsSet("remove-labels") {
|
||||||
|
val := ctx.String("remove-labels")
|
||||||
|
opts.RemoveLabels = strings.Split(val, ",")
|
||||||
|
}
|
||||||
|
return &opts, nil
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
@ -28,6 +27,7 @@ var CmdIssues = cli.Command{
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
&issues.CmdIssuesList,
|
&issues.CmdIssuesList,
|
||||||
&issues.CmdIssuesCreate,
|
&issues.CmdIssuesCreate,
|
||||||
|
&issues.CmdIssuesEdit,
|
||||||
&issues.CmdIssuesReopen,
|
&issues.CmdIssuesReopen,
|
||||||
&issues.CmdIssuesClose,
|
&issues.CmdIssuesClose,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package issues
|
package issues
|
||||||
|
|
||||||
|
@ -19,9 +18,9 @@ import (
|
||||||
// CmdIssuesClose represents a sub command of issues to close an issue
|
// CmdIssuesClose represents a sub command of issues to close an issue
|
||||||
var CmdIssuesClose = cli.Command{
|
var CmdIssuesClose = cli.Command{
|
||||||
Name: "close",
|
Name: "close",
|
||||||
Usage: "Change state of an issue to 'closed'",
|
Usage: "Change state of one ore more issues to 'closed'",
|
||||||
Description: `Change state of an issue to 'closed'`,
|
Description: `Change state of one ore more issues to 'closed'`,
|
||||||
ArgsUsage: "<issue index>",
|
ArgsUsage: "<issue index> [<issue index>...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
var s = gitea.StateClosed
|
var s = gitea.StateClosed
|
||||||
return editIssueState(ctx, gitea.EditIssueOption{State: &s})
|
return editIssueState(ctx, gitea.EditIssueOption{State: &s})
|
||||||
|
@ -37,16 +36,23 @@ func editIssueState(cmd *cli.Context, opts gitea.EditIssueOption) error {
|
||||||
return fmt.Errorf(ctx.Command.ArgsUsage)
|
return fmt.Errorf(ctx.Command.ArgsUsage)
|
||||||
}
|
}
|
||||||
|
|
||||||
index, err := utils.ArgToIndex(ctx.Args().First())
|
indices, err := utils.ArgsToIndices(ctx.Args().Slice())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, _, err := ctx.Login.Client().EditIssue(ctx.Owner, ctx.Repo, index, opts)
|
client := ctx.Login.Client()
|
||||||
if err != nil {
|
for _, index := range indices {
|
||||||
return err
|
issue, _, err := client.EditIssue(ctx.Owner, ctx.Repo, index, opts)
|
||||||
}
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
print.IssueDetails(issue, nil)
|
if len(indices) > 1 {
|
||||||
|
fmt.Println(issue.HTMLURL)
|
||||||
|
} else {
|
||||||
|
print.IssueDetails(issue, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package issues
|
package issues
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ var CmdIssuesCreate = cli.Command{
|
||||||
Description: `Create an issue on repository`,
|
Description: `Create an issue on repository`,
|
||||||
ArgsUsage: " ", // command does not accept arguments
|
ArgsUsage: " ", // command does not accept arguments
|
||||||
Action: runIssuesCreate,
|
Action: runIssuesCreate,
|
||||||
Flags: flags.IssuePREditFlags,
|
Flags: flags.IssuePRCreateFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runIssuesCreate(cmd *cli.Context) error {
|
func runIssuesCreate(cmd *cli.Context) error {
|
||||||
|
@ -32,7 +31,7 @@ func runIssuesCreate(cmd *cli.Context) error {
|
||||||
return interact.CreateIssue(ctx.Login, ctx.Owner, ctx.Repo)
|
return interact.CreateIssue(ctx.Login, ctx.Owner, ctx.Repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
opts, err := flags.GetIssuePREditFlags(ctx)
|
opts, err := flags.GetIssuePRCreateFlags(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package issues
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/print"
|
||||||
|
"code.gitea.io/tea/modules/task"
|
||||||
|
"code.gitea.io/tea/modules/utils"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdIssuesEdit is the subcommand of issues to edit issues
|
||||||
|
var CmdIssuesEdit = cli.Command{
|
||||||
|
Name: "edit",
|
||||||
|
Aliases: []string{"e"},
|
||||||
|
Usage: "Edit one or more issues",
|
||||||
|
Description: `Edit one or more issues. To unset a property again,
|
||||||
|
use an empty string (eg. --milestone "").`,
|
||||||
|
ArgsUsage: "<idx> [<idx>...]",
|
||||||
|
Action: runIssuesEdit,
|
||||||
|
Flags: flags.IssuePREditFlags,
|
||||||
|
}
|
||||||
|
|
||||||
|
func runIssuesEdit(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
|
||||||
|
if !cmd.Args().Present() {
|
||||||
|
return fmt.Errorf("must specify at least one issue index")
|
||||||
|
}
|
||||||
|
|
||||||
|
opts, err := flags.GetIssuePREditFlags(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
indices, err := utils.ArgsToIndices(ctx.Args().Slice())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
for _, opts.Index = range indices {
|
||||||
|
issue, err := task.EditIssue(ctx, client, *opts)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if ctx.Args().Len() > 1 {
|
||||||
|
fmt.Println(issue.HTMLURL)
|
||||||
|
} else {
|
||||||
|
print.IssueDetails(issue, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package issues
|
package issues
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var issueFieldsFlag = flags.FieldsFlag(print.IssueFields, []string{
|
var issueFieldsFlag = flags.FieldsFlag(print.IssueFields, []string{
|
||||||
"index", "title", "state", "author", "milestone", "labels",
|
"index", "title", "state", "author", "milestone", "labels", "owner", "repo",
|
||||||
})
|
})
|
||||||
|
|
||||||
// CmdIssuesList represents a sub command of issues to list issues
|
// CmdIssuesList represents a sub command of issues to list issues
|
||||||
|
@ -35,7 +34,6 @@ var CmdIssuesList = cli.Command{
|
||||||
// RunIssuesList list issues
|
// RunIssuesList list issues
|
||||||
func RunIssuesList(cmd *cli.Context) error {
|
func RunIssuesList(cmd *cli.Context) error {
|
||||||
ctx := context.InitCommand(cmd)
|
ctx := context.InitCommand(cmd)
|
||||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
|
||||||
|
|
||||||
state := gitea.StateOpen
|
state := gitea.StateOpen
|
||||||
switch ctx.String("state") {
|
switch ctx.String("state") {
|
||||||
|
@ -75,27 +73,52 @@ func RunIssuesList(cmd *cli.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
owner := ctx.Owner
|
||||||
|
if ctx.IsSet("owner") {
|
||||||
|
owner = ctx.String("owner")
|
||||||
|
}
|
||||||
|
|
||||||
// ignore error, as we don't do any input validation on these flags
|
// ignore error, as we don't do any input validation on these flags
|
||||||
labels, _ := flags.LabelFilterFlag.GetValues(cmd)
|
labels, _ := flags.LabelFilterFlag.GetValues(cmd)
|
||||||
milestones, _ := flags.MilestoneFilterFlag.GetValues(cmd)
|
milestones, _ := flags.MilestoneFilterFlag.GetValues(cmd)
|
||||||
|
var issues []*gitea.Issue
|
||||||
|
if ctx.Repo != "" {
|
||||||
|
issues, _, err = ctx.Login.Client().ListRepoIssues(owner, ctx.Repo, gitea.ListIssueOption{
|
||||||
|
ListOptions: ctx.GetListOptions(),
|
||||||
|
State: state,
|
||||||
|
Type: kind,
|
||||||
|
KeyWord: ctx.String("keyword"),
|
||||||
|
CreatedBy: ctx.String("author"),
|
||||||
|
AssignedBy: ctx.String("assigned-to"),
|
||||||
|
MentionedBy: ctx.String("mentions"),
|
||||||
|
Labels: labels,
|
||||||
|
Milestones: milestones,
|
||||||
|
Since: from,
|
||||||
|
Before: until,
|
||||||
|
})
|
||||||
|
|
||||||
issues, _, err := ctx.Login.Client().ListRepoIssues(ctx.Owner, ctx.Repo, gitea.ListIssueOption{
|
if err != nil {
|
||||||
ListOptions: ctx.GetListOptions(),
|
return err
|
||||||
State: state,
|
}
|
||||||
Type: kind,
|
} else {
|
||||||
KeyWord: ctx.String("keyword"),
|
issues, _, err = ctx.Login.Client().ListIssues(gitea.ListIssueOption{
|
||||||
CreatedBy: ctx.String("author"),
|
ListOptions: ctx.GetListOptions(),
|
||||||
AssignedBy: ctx.String("assigned-to"),
|
State: state,
|
||||||
MentionedBy: ctx.String("mentions"),
|
Type: kind,
|
||||||
Labels: labels,
|
KeyWord: ctx.String("keyword"),
|
||||||
Milestones: milestones,
|
CreatedBy: ctx.String("author"),
|
||||||
Since: from,
|
AssignedBy: ctx.String("assigned-to"),
|
||||||
Before: until,
|
MentionedBy: ctx.String("mentions"),
|
||||||
})
|
Labels: labels,
|
||||||
|
Milestones: milestones,
|
||||||
|
Since: from,
|
||||||
|
Before: until,
|
||||||
|
Owner: owner,
|
||||||
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fields, err := issueFieldsFlag.GetValues(cmd)
|
fields, err := issueFieldsFlag.GetValues(cmd)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package issues
|
package issues
|
||||||
|
|
||||||
|
@ -15,9 +14,9 @@ import (
|
||||||
var CmdIssuesReopen = cli.Command{
|
var CmdIssuesReopen = cli.Command{
|
||||||
Name: "reopen",
|
Name: "reopen",
|
||||||
Aliases: []string{"open"},
|
Aliases: []string{"open"},
|
||||||
Usage: "Change state of an issue to 'open'",
|
Usage: "Change state of one or more issues to 'open'",
|
||||||
Description: `Change state of an issue to 'open'`,
|
Description: `Change state of one or more issues to 'open'`,
|
||||||
ArgsUsage: "<issue index>",
|
ArgsUsage: "<issue index> [<issue index>...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
var s = gitea.StateOpen
|
var s = gitea.StateOpen
|
||||||
return editIssueState(ctx, gitea.EditIssueOption{State: &s})
|
return editIssueState(ctx, gitea.EditIssueOption{State: &s})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package labels
|
package labels
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package labels
|
package labels
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package labels
|
package labels
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package labels
|
package labels
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package labels
|
package labels
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package login
|
package login
|
||||||
|
|
||||||
|
@ -30,6 +29,11 @@ var CmdLoginAdd = cli.Command{
|
||||||
EnvVars: []string{"GITEA_SERVER_URL"},
|
EnvVars: []string{"GITEA_SERVER_URL"},
|
||||||
Usage: "Server URL",
|
Usage: "Server URL",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "no-version-check",
|
||||||
|
Aliases: []string{"nv"},
|
||||||
|
Usage: "Do not check version of Gitea instance",
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "token",
|
Name: "token",
|
||||||
Aliases: []string{"t"},
|
Aliases: []string{"t"},
|
||||||
|
@ -50,16 +54,36 @@ var CmdLoginAdd = cli.Command{
|
||||||
EnvVars: []string{"GITEA_SERVER_PASSWORD"},
|
EnvVars: []string{"GITEA_SERVER_PASSWORD"},
|
||||||
Usage: "Password for basic auth (will create token)",
|
Usage: "Password for basic auth (will create token)",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "otp",
|
||||||
|
EnvVars: []string{"GITEA_SERVER_OTP"},
|
||||||
|
Usage: "OTP token for auth, if necessary",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "scopes",
|
||||||
|
EnvVars: []string{"GITEA_SCOPES"},
|
||||||
|
Usage: "Token scopes to add when creating a new token, separated by a comma",
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "ssh-key",
|
Name: "ssh-key",
|
||||||
Aliases: []string{"s"},
|
Aliases: []string{"s"},
|
||||||
Usage: "Path to a SSH key to use, overrides auto-discovery",
|
Usage: "Path to a SSH key/certificate to use, overrides auto-discovery",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "insecure",
|
Name: "insecure",
|
||||||
Aliases: []string{"i"},
|
Aliases: []string{"i"},
|
||||||
Usage: "Disable TLS verification",
|
Usage: "Disable TLS verification",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "ssh-agent-principal",
|
||||||
|
Aliases: []string{"c"},
|
||||||
|
Usage: "Use SSH certificate with specified principal to login (needs a running ssh-agent with certificate loaded)",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "ssh-agent-key",
|
||||||
|
Aliases: []string{"a"},
|
||||||
|
Usage: "Use SSH public key or SSH fingerprint to login (needs a running ssh-agent with ssh key loaded)",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: runLoginAdd,
|
Action: runLoginAdd,
|
||||||
}
|
}
|
||||||
|
@ -70,13 +94,24 @@ func runLoginAdd(ctx *cli.Context) error {
|
||||||
return interact.CreateLogin()
|
return interact.CreateLogin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sshAgent := false
|
||||||
|
if ctx.String("ssh-agent-key") != "" || ctx.String("ssh-agent-principal") != "" {
|
||||||
|
sshAgent = true
|
||||||
|
}
|
||||||
|
|
||||||
// else use args to add login
|
// else use args to add login
|
||||||
return task.CreateLogin(
|
return task.CreateLogin(
|
||||||
ctx.String("name"),
|
ctx.String("name"),
|
||||||
ctx.String("token"),
|
ctx.String("token"),
|
||||||
ctx.String("user"),
|
ctx.String("user"),
|
||||||
ctx.String("password"),
|
ctx.String("password"),
|
||||||
|
ctx.String("otp"),
|
||||||
|
ctx.String("scopes"),
|
||||||
ctx.String("ssh-key"),
|
ctx.String("ssh-key"),
|
||||||
ctx.String("url"),
|
ctx.String("url"),
|
||||||
ctx.Bool("insecure"))
|
ctx.String("ssh-agent-principal"),
|
||||||
|
ctx.String("ssh-agent-key"),
|
||||||
|
ctx.Bool("insecure"),
|
||||||
|
sshAgent,
|
||||||
|
!ctx.Bool("no-version-check"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package login
|
package login
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package login
|
package login
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package login
|
package login
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package login
|
package login
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
|
@ -13,9 +12,9 @@ import (
|
||||||
// CmdMilestonesClose represents a sub command of milestones to close an milestone
|
// CmdMilestonesClose represents a sub command of milestones to close an milestone
|
||||||
var CmdMilestonesClose = cli.Command{
|
var CmdMilestonesClose = cli.Command{
|
||||||
Name: "close",
|
Name: "close",
|
||||||
Usage: "Change state of an milestone to 'closed'",
|
Usage: "Change state of one or more milestones to 'closed'",
|
||||||
Description: `Change state of an milestone to 'closed'`,
|
Description: `Change state of one or more milestones to 'closed'`,
|
||||||
ArgsUsage: "<milestone name>",
|
ArgsUsage: "<milestone name> [<milestone name>...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
if ctx.Bool("force") {
|
if ctx.Bool("force") {
|
||||||
return deleteMilestone(ctx)
|
return deleteMilestone(ctx)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package milestones
|
package milestones
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"code.gitea.io/tea/cmd/flags"
|
"code.gitea.io/tea/cmd/flags"
|
||||||
"code.gitea.io/tea/modules/context"
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/print"
|
||||||
|
|
||||||
"code.gitea.io/sdk/gitea"
|
"code.gitea.io/sdk/gitea"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
@ -16,9 +18,9 @@ import (
|
||||||
var CmdMilestonesReopen = cli.Command{
|
var CmdMilestonesReopen = cli.Command{
|
||||||
Name: "reopen",
|
Name: "reopen",
|
||||||
Aliases: []string{"open"},
|
Aliases: []string{"open"},
|
||||||
Usage: "Change state of an milestone to 'open'",
|
Usage: "Change state of one or more milestones to 'open'",
|
||||||
Description: `Change state of an milestone to 'open'`,
|
Description: `Change state of one or more milestones to 'open'`,
|
||||||
ArgsUsage: "<milestone name>",
|
ArgsUsage: "<milestone name> [<milestone name> ...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
return editMilestoneStatus(ctx, false)
|
return editMilestoneStatus(ctx, false)
|
||||||
},
|
},
|
||||||
|
@ -28,16 +30,31 @@ var CmdMilestonesReopen = cli.Command{
|
||||||
func editMilestoneStatus(cmd *cli.Context, close bool) error {
|
func editMilestoneStatus(cmd *cli.Context, close bool) error {
|
||||||
ctx := context.InitCommand(cmd)
|
ctx := context.InitCommand(cmd)
|
||||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
client := ctx.Login.Client()
|
if ctx.Args().Len() == 0 {
|
||||||
|
return fmt.Errorf(ctx.Command.ArgsUsage)
|
||||||
|
}
|
||||||
|
|
||||||
state := gitea.StateOpen
|
state := gitea.StateOpen
|
||||||
if close {
|
if close {
|
||||||
state = gitea.StateClosed
|
state = gitea.StateClosed
|
||||||
}
|
}
|
||||||
_, _, err := client.EditMilestoneByName(ctx.Owner, ctx.Repo, ctx.Args().First(), gitea.EditMilestoneOption{
|
|
||||||
State: &state,
|
|
||||||
Title: ctx.Args().First(),
|
|
||||||
})
|
|
||||||
|
|
||||||
return err
|
client := ctx.Login.Client()
|
||||||
|
for _, ms := range ctx.Args().Slice() {
|
||||||
|
opts := gitea.EditMilestoneOption{
|
||||||
|
State: &state,
|
||||||
|
Title: ms,
|
||||||
|
}
|
||||||
|
milestone, _, err := client.EditMilestoneByName(ctx.Owner, ctx.Repo, ms, opts)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.Args().Len() > 1 {
|
||||||
|
fmt.Printf("%s/milestone/%d\n", ctx.GetRemoteRepoHTMLURL(), milestone.ID)
|
||||||
|
} else {
|
||||||
|
print.MilestoneDetails(milestone)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package notifications
|
package notifications
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package notifications
|
package notifications
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
@ -74,6 +73,5 @@ func runOpen(cmd *cli.Context) error {
|
||||||
suffix = number
|
suffix = number
|
||||||
}
|
}
|
||||||
|
|
||||||
u := path.Join(ctx.Login.URL, ctx.Owner, ctx.Repo, suffix)
|
return open.Run(path.Join(ctx.GetRemoteRepoHTMLURL(), suffix))
|
||||||
return open.Run(u)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package organizations
|
package organizations
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package organizations
|
package organizations
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package organizations
|
package organizations
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
@ -14,9 +13,9 @@ import (
|
||||||
// CmdPullsClose closes a given open pull request
|
// CmdPullsClose closes a given open pull request
|
||||||
var CmdPullsClose = cli.Command{
|
var CmdPullsClose = cli.Command{
|
||||||
Name: "close",
|
Name: "close",
|
||||||
Usage: "Change state of a pull request to 'closed'",
|
Usage: "Change state of one or more pull requests to 'closed'",
|
||||||
Description: `Change state of a pull request to 'closed'`,
|
Description: `Change state of one or more pull requests to 'closed'`,
|
||||||
ArgsUsage: "<pull index>",
|
ArgsUsage: "<pull index> [<pull index>...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
var s = gitea.StateClosed
|
var s = gitea.StateClosed
|
||||||
return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
|
return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
@ -30,7 +29,13 @@ var CmdPullsCreate = cli.Command{
|
||||||
Aliases: []string{"b"},
|
Aliases: []string{"b"},
|
||||||
Usage: "Branch name of the PR target (default is repos default branch)",
|
Usage: "Branch name of the PR target (default is repos default branch)",
|
||||||
},
|
},
|
||||||
}, flags.IssuePREditFlags...),
|
&cli.BoolFlag{
|
||||||
|
Name: "allow-maintainer-edits",
|
||||||
|
Aliases: []string{"edits"},
|
||||||
|
Usage: "Enable maintainers to push to the base branch of created pull",
|
||||||
|
Value: true,
|
||||||
|
},
|
||||||
|
}, flags.IssuePRCreateFlags...),
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPullsCreate(cmd *cli.Context) error {
|
func runPullsCreate(cmd *cli.Context) error {
|
||||||
|
@ -42,7 +47,7 @@ func runPullsCreate(cmd *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// else use args to create PR
|
// else use args to create PR
|
||||||
opts, err := flags.GetIssuePREditFlags(ctx)
|
opts, err := flags.GetIssuePRCreateFlags(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -51,6 +56,7 @@ func runPullsCreate(cmd *cli.Context) error {
|
||||||
ctx,
|
ctx,
|
||||||
ctx.String("base"),
|
ctx.String("base"),
|
||||||
ctx.String("head"),
|
ctx.String("head"),
|
||||||
|
ctx.Bool("allow-maintainer-edits"),
|
||||||
opts,
|
opts,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
@ -23,16 +22,23 @@ func editPullState(cmd *cli.Context, opts gitea.EditPullRequestOption) error {
|
||||||
return fmt.Errorf("Please provide a Pull Request index")
|
return fmt.Errorf("Please provide a Pull Request index")
|
||||||
}
|
}
|
||||||
|
|
||||||
index, err := utils.ArgToIndex(ctx.Args().First())
|
indices, err := utils.ArgsToIndices(ctx.Args().Slice())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pr, _, err := ctx.Login.Client().EditPullRequest(ctx.Owner, ctx.Repo, index, opts)
|
client := ctx.Login.Client()
|
||||||
if err != nil {
|
for _, index := range indices {
|
||||||
return err
|
pr, _, err := client.EditPullRequest(ctx.Owner, ctx.Repo, index, opts)
|
||||||
}
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
print.PullDetails(pr, nil, nil)
|
if len(indices) > 1 {
|
||||||
|
fmt.Println(pr.HTMLURL)
|
||||||
|
} else {
|
||||||
|
print.PullDetails(pr, nil, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"code.gitea.io/sdk/gitea"
|
"code.gitea.io/sdk/gitea"
|
||||||
"code.gitea.io/tea/cmd/flags"
|
"code.gitea.io/tea/cmd/flags"
|
||||||
"code.gitea.io/tea/modules/context"
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/interact"
|
||||||
|
"code.gitea.io/tea/modules/task"
|
||||||
"code.gitea.io/tea/modules/utils"
|
"code.gitea.io/tea/modules/utils"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
@ -45,7 +44,8 @@ var CmdPullsMerge = cli.Command{
|
||||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
|
|
||||||
if ctx.Args().Len() != 1 {
|
if ctx.Args().Len() != 1 {
|
||||||
return fmt.Errorf("Must specify a PR index")
|
// If no PR index is provided, try interactive mode
|
||||||
|
return interact.MergePull(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
idx, err := utils.ArgToIndex(ctx.Args().First())
|
idx, err := utils.ArgToIndex(ctx.Args().First())
|
||||||
|
@ -53,18 +53,10 @@ var CmdPullsMerge = cli.Command{
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
success, _, err := ctx.Login.Client().MergePullRequest(ctx.Owner, ctx.Repo, idx, gitea.MergePullRequestOption{
|
return task.PullMerge(ctx.Login, ctx.Owner, ctx.Repo, idx, gitea.MergePullRequestOption{
|
||||||
Style: gitea.MergeStyle(ctx.String("style")),
|
Style: gitea.MergeStyle(ctx.String("style")),
|
||||||
Title: ctx.String("title"),
|
Title: ctx.String("title"),
|
||||||
Message: ctx.String("message"),
|
Message: ctx.String("message"),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !success {
|
|
||||||
return fmt.Errorf("Failed to merge PR. Is it still open?")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
@ -15,9 +14,9 @@ import (
|
||||||
var CmdPullsReopen = cli.Command{
|
var CmdPullsReopen = cli.Command{
|
||||||
Name: "reopen",
|
Name: "reopen",
|
||||||
Aliases: []string{"open"},
|
Aliases: []string{"open"},
|
||||||
Usage: "Change state of a pull request to 'open'",
|
Usage: "Change state of one or more pull requests to 'open'",
|
||||||
Description: `Change state of a pull request to 'open'`,
|
Description: `Change state of one or more pull requests to 'open'`,
|
||||||
ArgsUsage: "<pull index>",
|
ArgsUsage: "<pull index> [<pull index>...]",
|
||||||
Action: func(ctx *cli.Context) error {
|
Action: func(ctx *cli.Context) error {
|
||||||
var s = gitea.StateOpen
|
var s = gitea.StateOpen
|
||||||
return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
|
return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package pulls
|
package pulls
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ var CmdReleases = cli.Command{
|
||||||
&releases.CmdReleaseCreate,
|
&releases.CmdReleaseCreate,
|
||||||
&releases.CmdReleaseDelete,
|
&releases.CmdReleaseDelete,
|
||||||
&releases.CmdReleaseEdit,
|
&releases.CmdReleaseEdit,
|
||||||
|
&CmdReleaseAttachments,
|
||||||
},
|
},
|
||||||
Flags: flags.AllDefaultFlags,
|
Flags: flags.AllDefaultFlags,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package releases
|
package releases
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package releases
|
package releases
|
||||||
|
|
||||||
|
@ -17,9 +16,9 @@ import (
|
||||||
var CmdReleaseDelete = cli.Command{
|
var CmdReleaseDelete = cli.Command{
|
||||||
Name: "delete",
|
Name: "delete",
|
||||||
Aliases: []string{"rm"},
|
Aliases: []string{"rm"},
|
||||||
Usage: "Delete a release",
|
Usage: "Delete one or more releases",
|
||||||
Description: `Delete a release`,
|
Description: `Delete one or more releases`,
|
||||||
ArgsUsage: "<release tag>",
|
ArgsUsage: "<release tag> [<release tag>...]",
|
||||||
Action: runReleaseDelete,
|
Action: runReleaseDelete,
|
||||||
Flags: append([]cli.Flag{
|
Flags: append([]cli.Flag{
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
|
@ -39,9 +38,8 @@ func runReleaseDelete(cmd *cli.Context) error {
|
||||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
client := ctx.Login.Client()
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
tag := ctx.Args().First()
|
if !ctx.Args().Present() {
|
||||||
if len(tag) == 0 {
|
fmt.Println("Release tag needed to edit")
|
||||||
fmt.Println("Release tag needed to delete")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,18 +48,20 @@ func runReleaseDelete(cmd *cli.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
for _, tag := range ctx.Args().Slice() {
|
||||||
if err != nil {
|
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
_, err = client.DeleteRelease(ctx.Owner, ctx.Repo, release.ID)
|
}
|
||||||
if err != nil {
|
_, err = client.DeleteRelease(ctx.Owner, ctx.Repo, release.ID)
|
||||||
return err
|
if err != nil {
|
||||||
}
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if ctx.Bool("delete-tag") {
|
if ctx.Bool("delete-tag") {
|
||||||
_, err = client.DeleteTag(ctx.Owner, ctx.Repo, tag)
|
_, err = client.DeleteTag(ctx.Owner, ctx.Repo, tag)
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package releases
|
package releases
|
||||||
|
|
||||||
|
@ -19,9 +18,9 @@ import (
|
||||||
var CmdReleaseEdit = cli.Command{
|
var CmdReleaseEdit = cli.Command{
|
||||||
Name: "edit",
|
Name: "edit",
|
||||||
Aliases: []string{"e"},
|
Aliases: []string{"e"},
|
||||||
Usage: "Edit a release",
|
Usage: "Edit one or more releases",
|
||||||
Description: `Edit a release`,
|
Description: `Edit one or more releases`,
|
||||||
ArgsUsage: "<release tag>",
|
ArgsUsage: "<release tag> [<release tag>...]",
|
||||||
Action: runReleaseEdit,
|
Action: runReleaseEdit,
|
||||||
Flags: append([]cli.Flag{
|
Flags: append([]cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
|
@ -62,16 +61,6 @@ func runReleaseEdit(cmd *cli.Context) error {
|
||||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||||
client := ctx.Login.Client()
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
tag := ctx.Args().First()
|
|
||||||
if len(tag) == 0 {
|
|
||||||
fmt.Println("Release tag needed to edit")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
var isDraft, isPre *bool
|
var isDraft, isPre *bool
|
||||||
if ctx.IsSet("draft") {
|
if ctx.IsSet("draft") {
|
||||||
isDraft = gitea.OptionalBool(strings.ToLower(ctx.String("draft"))[:1] == "t")
|
isDraft = gitea.OptionalBool(strings.ToLower(ctx.String("draft"))[:1] == "t")
|
||||||
|
@ -80,13 +69,28 @@ func runReleaseEdit(cmd *cli.Context) error {
|
||||||
isPre = gitea.OptionalBool(strings.ToLower(ctx.String("prerelease"))[:1] == "t")
|
isPre = gitea.OptionalBool(strings.ToLower(ctx.String("prerelease"))[:1] == "t")
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, err = client.EditRelease(ctx.Owner, ctx.Repo, release.ID, gitea.EditReleaseOption{
|
if !ctx.Args().Present() {
|
||||||
TagName: ctx.String("tag"),
|
fmt.Println("Release tag needed to edit")
|
||||||
Target: ctx.String("target"),
|
return nil
|
||||||
Title: ctx.String("title"),
|
}
|
||||||
Note: ctx.String("note"),
|
|
||||||
IsDraft: isDraft,
|
for _, tag := range ctx.Args().Slice() {
|
||||||
IsPrerelease: isPre,
|
release, err := getReleaseByTag(ctx.Owner, ctx.Repo, tag, client)
|
||||||
})
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, _, err = client.EditRelease(ctx.Owner, ctx.Repo, release.ID, gitea.EditReleaseOption{
|
||||||
|
TagName: ctx.String("tag"),
|
||||||
|
Target: ctx.String("target"),
|
||||||
|
Title: ctx.String("title"),
|
||||||
|
Note: ctx.String("note"),
|
||||||
|
IsDraft: isDraft,
|
||||||
|
IsPrerelease: isPre,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package releases
|
package releases
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
@ -29,6 +28,8 @@ var CmdRepos = cli.Command{
|
||||||
&repos.CmdRepoCreate,
|
&repos.CmdRepoCreate,
|
||||||
&repos.CmdRepoCreateFromTemplate,
|
&repos.CmdRepoCreateFromTemplate,
|
||||||
&repos.CmdRepoFork,
|
&repos.CmdRepoFork,
|
||||||
|
&repos.CmdRepoMigrate,
|
||||||
|
&repos.CmdRepoRm,
|
||||||
},
|
},
|
||||||
Flags: repos.CmdReposListFlags,
|
Flags: repos.CmdReposListFlags,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package repos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
|
||||||
|
"github.com/AlecAivazis/survey/v2"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdRepoRm represents a sub command of repos to delete an existing repo
|
||||||
|
var CmdRepoRm = cli.Command{
|
||||||
|
Name: "delete",
|
||||||
|
Aliases: []string{"rm"},
|
||||||
|
Usage: "Delete an existing repository",
|
||||||
|
Description: "Removes a repository from Create a repository from an existing repo",
|
||||||
|
ArgsUsage: " ", // command does not accept arguments
|
||||||
|
Action: runRepoDelete,
|
||||||
|
Flags: append([]cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "name",
|
||||||
|
Aliases: []string{""},
|
||||||
|
Required: true,
|
||||||
|
Usage: "name of the repo",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "owner",
|
||||||
|
Aliases: []string{"O"},
|
||||||
|
Required: false,
|
||||||
|
Usage: "owner of the repo",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "force",
|
||||||
|
Aliases: []string{"f"},
|
||||||
|
Required: false,
|
||||||
|
Value: false,
|
||||||
|
Usage: "Force the deletion and don't ask for confirmation",
|
||||||
|
},
|
||||||
|
}, flags.LoginOutputFlags...),
|
||||||
|
}
|
||||||
|
|
||||||
|
func runRepoDelete(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
|
||||||
|
var owner string
|
||||||
|
if ctx.IsSet("owner") {
|
||||||
|
owner = ctx.String("owner")
|
||||||
|
|
||||||
|
} else {
|
||||||
|
owner = ctx.Login.User
|
||||||
|
}
|
||||||
|
|
||||||
|
repoName := ctx.String("name")
|
||||||
|
|
||||||
|
repoSlug := fmt.Sprintf("%s/%s", owner, repoName)
|
||||||
|
|
||||||
|
if !ctx.Bool("force") {
|
||||||
|
var enteredRepoSlug string
|
||||||
|
promptRepoName := &survey.Input{
|
||||||
|
Message: fmt.Sprintf("Confirm the deletion of the repository '%s' by typing its name: ", repoSlug),
|
||||||
|
}
|
||||||
|
if err := survey.AskOne(promptRepoName, &enteredRepoSlug, survey.WithValidator(survey.Required)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if enteredRepoSlug != repoSlug {
|
||||||
|
return fmt.Errorf("Entered wrong repository name '%s', expected '%s'", enteredRepoSlug, repoSlug)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := client.DeleteRepo(owner, repoName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Successfully deleted %s/%s\n", owner, repoName)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
package repos
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/cmd/flags"
|
||||||
|
"code.gitea.io/tea/modules/context"
|
||||||
|
"code.gitea.io/tea/modules/print"
|
||||||
|
|
||||||
|
"code.gitea.io/sdk/gitea"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CmdRepoMigrate represents a sub command of repos to migrate one
|
||||||
|
var CmdRepoMigrate = cli.Command{
|
||||||
|
Name: "migrate",
|
||||||
|
Aliases: []string{"m"},
|
||||||
|
Usage: "Migrate a repository",
|
||||||
|
Description: "Migrate a repository and or mirror it.",
|
||||||
|
ArgsUsage: " ", // command does not accept arguments
|
||||||
|
Action: runRepoMigrate,
|
||||||
|
Flags: append([]cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "name",
|
||||||
|
Usage: "Name of the repository",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "owner",
|
||||||
|
Usage: "Owner of the repository",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "clone-url",
|
||||||
|
Usage: "Clone URL of the repository",
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "service",
|
||||||
|
Usage: string("Service to migrate from. Supported services are: " + gitea.GitServicePlain +
|
||||||
|
", " + gitea.GitServiceGitea + ", " + gitea.GitServiceGitlab + ", " + gitea.GitServiceGogs),
|
||||||
|
Required: true,
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "mirror",
|
||||||
|
Usage: "Mirror the repository",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "private",
|
||||||
|
Usage: "Make the repository private",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "template",
|
||||||
|
Usage: "Make the repository a template",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "wiki",
|
||||||
|
Usage: "Copy the wiki",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "issues",
|
||||||
|
Usage: "Copy the issues",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "pull-requests",
|
||||||
|
Usage: "Copy the pull requests",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "releases",
|
||||||
|
Usage: "Copy the releases",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "milestones",
|
||||||
|
Usage: "Copy the milestones",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "mirror-interval",
|
||||||
|
Usage: "Interval to mirror the repository.",
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "lfs",
|
||||||
|
Usage: "Copy the LFS objects",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "lfs-endpoint",
|
||||||
|
Usage: "LFS endpoint to use",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "auth-user",
|
||||||
|
Usage: "Username to use for authentication.",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "auth-password",
|
||||||
|
Usage: "Password to use for authentication.",
|
||||||
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "auth-token",
|
||||||
|
Usage: "Token to use for authentication.",
|
||||||
|
},
|
||||||
|
}, flags.LoginOutputFlags...),
|
||||||
|
}
|
||||||
|
|
||||||
|
func runRepoMigrate(cmd *cli.Context) error {
|
||||||
|
ctx := context.InitCommand(cmd)
|
||||||
|
client := ctx.Login.Client()
|
||||||
|
var (
|
||||||
|
repo *gitea.Repository
|
||||||
|
err error
|
||||||
|
service gitea.GitServiceType
|
||||||
|
)
|
||||||
|
|
||||||
|
if ctx.IsSet("service") {
|
||||||
|
switch ctx.String("service") {
|
||||||
|
case "git":
|
||||||
|
service = gitea.GitServicePlain
|
||||||
|
case "gitea":
|
||||||
|
service = gitea.GitServiceGitea
|
||||||
|
case "gitlab":
|
||||||
|
service = gitea.GitServiceGitlab
|
||||||
|
case "gogs":
|
||||||
|
service = gitea.GitServiceGogs
|
||||||
|
case "github":
|
||||||
|
service = gitea.GitServiceGithub
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unknown git service type '%s'", ctx.String("service"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opts := gitea.MigrateRepoOption{
|
||||||
|
RepoName: ctx.String("name"),
|
||||||
|
RepoOwner: ctx.String("owner"),
|
||||||
|
CloneAddr: ctx.String("clone-url"),
|
||||||
|
Service: service,
|
||||||
|
AuthUsername: ctx.String("auth-user"),
|
||||||
|
AuthPassword: ctx.String("auth-password"),
|
||||||
|
AuthToken: ctx.String("auth-token"),
|
||||||
|
Mirror: ctx.Bool("mirror"),
|
||||||
|
Private: ctx.Bool("private"),
|
||||||
|
Description: ctx.String("description"),
|
||||||
|
Wiki: ctx.Bool("wiki"),
|
||||||
|
Milestones: ctx.Bool("milestones"),
|
||||||
|
Labels: ctx.Bool("labels"),
|
||||||
|
Issues: ctx.Bool("issues"),
|
||||||
|
PullRequests: ctx.Bool("pull-requests"),
|
||||||
|
Releases: ctx.Bool("releases"),
|
||||||
|
MirrorInterval: ctx.String("mirror-interval"),
|
||||||
|
LFS: ctx.Bool("lfs"),
|
||||||
|
LFSEndpoint: ctx.String("lfs-endpoint"),
|
||||||
|
}
|
||||||
|
|
||||||
|
repo, _, err = client.MigrateRepo(opts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
topics, _, err := client.ListRepoTopics(repo.Owner.UserName, repo.Name, gitea.ListRepoTopicsOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
print.RepoDetails(repo, topics)
|
||||||
|
|
||||||
|
fmt.Printf("%s\n", repo.HTMLURL)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package repos
|
package repos
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package times
|
package times
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package times
|
package times
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package times
|
package times
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2020 The Gitea Authors. All rights reserved.
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package times
|
package times
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Copyright 2021 The Gitea Authors. All rights reserved.
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// SPDX-License-Identifier: MIT
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"packages": [
|
||||||
|
"go@1.20",
|
||||||
|
"gopls@latest",
|
||||||
|
"gnumake@latest"
|
||||||
|
],
|
||||||
|
"shell": {
|
||||||
|
"init_hook": [
|
||||||
|
"echo 'Welcome to tea. Check out the Makefile for runnable targets.'"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "make"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue