github issues and PR's channels! #799
universalmind303
started this conversation in
Show and tell
Replies: 1 comment
-
|
These look awesome, great work! Fixed the background ANSI codes issue: gh-issues.toml[metadata]
name = "gh-issues"
description = "List GitHub issues for the current repo"
requirements = ["gh", "jq"]
[source]
command = '''gh issue list --state open --limit 200 --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.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 // "")
''''gh-prs.toml[metadata]
name = "gh-prs"
description = "List GitHub PRs for the current repo"
requirements = ["gh", " jq"]
[source]
command = '''gh pr 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)'
'''
output = '{strip_ansi|split:#:1|split: :0}'
ansi = true
[preview]
command = '''gh pr view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,headRefName,baseRefName,author,createdAt,updatedAt,mergeable,changedFiles,additions,deletions,labels,assignees,reviewDecision,headRepository,headRepositoryOwner | jq -r '
" " + .title,
" #" + (.number | tostring),
"",
" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m " + .baseRefName + " ← " + .headRefName,
" \u001b[36mRepo:\u001b[39m \u001b[34m" + (.headRepositoryOwner.login) + "/" + (.headRepository.name) + "\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),
" \u001b[36mMerge Status:\u001b[39m " + (if .mergeable == "MERGEABLE" then "\u001b[32m✓ Clean\u001b[39m" elif .mergeable == "CONFLICTING" then "\u001b[31m✗ Dirty\u001b[39m" else "\u001b[33m? Unknown\u001b[39m" end),
" \u001b[36mChanges:\u001b[39m " + (.changedFiles | tostring) + " files \u001b[32m+" + (.additions | tostring) + "\u001b[39m \u001b[31m-" + (.deletions | tostring) + "\u001b[39m",
"",
" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m",
"",
(.body // "")
''''
Would you like to make a PR to add these two channels to the repo? 😊 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
just wanted to share these two channels I came up with (inspired by lazyvim's git integration)
gh-issuesShows github issues with a nice preview
gh-prsBeta Was this translation helpful? Give feedback.
All reactions