Files

43 lines
1.8 KiB
TOML

[metadata]
name = "tea-prs"
description = "List Gitea PRs for the current repo"
requirements = ["tea", "jq"]
[source]
command = '''tea pulls list --output json --state open </dev/null | jq -r '.[] | "\u001b[32m#\(.index)\u001b[39m" + "\t\(.title) \u001b[33m@\(.author)\u001b[39m" + (if .labels != "" then " \u001b[35m" + .labels + "\u001b[39m" else "" end)'
'''
ansi = true
output = "{strip_ansi|split:#:1|split:\t:0}"
[ui]
layout = "portrait"
preview_panel = { header = '{strip_ansi|split:\t:1}', border_type = "none", scrollbar = false, padding = { left = 2, right = 1, top = 0, bottom = 0 } }
[preview]
command = '''tea pulls --output json {strip_ansi|split:#:1|split:\t:0} </dev/null | jq -r '
.title,
"#" + (.index | tostring),
"",
"\u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m " + .base + " ← " + .head,
"\u001b[36mAuthor:\u001b[39m \u001b[33m" + .user + "\u001b[39m",
"\u001b[36mCreated:\u001b[39m " + .created[:10],
"\u001b[36mUpdated:\u001b[39m " + .updated[:10],
(if (.labels | length) > 0 then "\u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else empty end),
"\u001b[36mMergeable:\u001b[39m " + (if .mergeable then "\u001b[32m✓ Clean\u001b[39m" else "\u001b[31m✗ Dirty\u001b[39m" end),
"",
"\u001b[90m────────────────────────────────────────────────────────────\u001b[39m",
"",
(.body // "")
'
'''
[actions.checkout]
description = "Checkout the PR branch locally"
command = "tea pulls checkout {strip_ansi|split:#:1|split:\t:0}"
mode = "execute"
[actions.merge]
description = "Merge the selected PR"
command = "tea pulls merge {strip_ansi|split:#:1|split:\t:0}"
mode = "execute"