mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
48 lines
2.3 KiB
TOML
48 lines
2.3 KiB
TOML
[metadata]
|
|
name = "gh-issues"
|
|
description = "List GitHub issues for the current repo"
|
|
requirements = ["gh", "jq"]
|
|
|
|
[source]
|
|
command = '''gh issue list --state open --limit 100 --json number,title,createdAt,author,labels | jq -r 'sort_by(.createdAt) | reverse | .[] | " \u001b[32m#\(.number)\u001b[39m \(.title) \u001b[33m@\(.author.login)\u001b[39m" + (if (.labels | length) > 0 then " " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end)'
|
|
'''
|
|
ansi = true
|
|
output = "{strip_ansi|split:#:1|split: :0}"
|
|
|
|
[ui]
|
|
layout = "portrait"
|
|
preview_panel = { header = '{strip_ansi|split:#:1|split: :0}' }
|
|
|
|
[preview]
|
|
command = '''gh issue view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,author,createdAt,updatedAt,labels,assignees | jq -r '
|
|
" " + .title,
|
|
" #" + (.number | tostring),
|
|
"",
|
|
" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m",
|
|
" \u001b[36mAuthor:\u001b[39m \u001b[33m" + .author.login + "\u001b[39m",
|
|
" \u001b[36mCreated:\u001b[39m " + (.createdAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
|
|
" \u001b[36mUpdated:\u001b[39m " + (.updatedAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
|
|
(if (.labels | length) > 0 then " \u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end),
|
|
(if (.assignees | length) > 0 then " \u001b[36mAssignees:\u001b[39m " + ([.assignees[].login] | join(", ")) else "" end),
|
|
"",
|
|
" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m",
|
|
"",
|
|
(.body // "")'
|
|
'''
|
|
|
|
[actions.open]
|
|
description = "Open the issue in the browser"
|
|
command = "gh issue view {strip_ansi|split:#:1|split: :0} --web"
|
|
mode = "fork"
|
|
|
|
[actions.close]
|
|
description = "Close the selected issue"
|
|
command = "gh issue close {strip_ansi|split:#:1|split: :0}"
|
|
mode = "fork"
|
|
|
|
[actions.comment]
|
|
description = "Add a comment to the selected issue"
|
|
command = "gh issue comment {strip_ansi|split:#:1|split: :0}"
|
|
mode = "execute"
|
|
|