mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-31 14:17:45 +00:00
feat(gh-completions): view inlined-comments (#1106)
Adds a command to see comments in github pullrequest. You can test it as follows  One problem I would like to solve is when comments are a very long single line, in that case the colum becomes very wide, using `explore` I have the sample problem. Is there an easy way to make text wrap inside a cell if text longer than a certain threshold e.g. 100 chars? 
This commit is contained in:
parent
9560df9370
commit
b442c96ec2
1 changed files with 21 additions and 0 deletions
|
@ -547,3 +547,24 @@ export extern "gh variable" [
|
||||||
--repo(-R) # Select another repository using the [HOST/]OWNER/REPO format
|
--repo(-R) # Select another repository using the [HOST/]OWNER/REPO format
|
||||||
--help # Show help for command
|
--help # Show help for command
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export def "gh pr view inlined-comments" [
|
||||||
|
pr?: int
|
||||||
|
repo?: string # e.g. nushell/nu_scripts
|
||||||
|
] {
|
||||||
|
# nushell/nu_scripts/pull/1105
|
||||||
|
let pr = if ($pr == null) { ^gh pr view --json number | from json | get number } else { $pr }
|
||||||
|
let repo = if ($repo == null) {
|
||||||
|
^gh repo view --json name,owner | from json | select owner.login name | rename owner name
|
||||||
|
} else {
|
||||||
|
$repo | parse '{owner}/{name}' | get 0
|
||||||
|
}
|
||||||
|
|
||||||
|
( (gh api
|
||||||
|
-H "Accept: application/vnd.github+json"
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28"
|
||||||
|
$"/repos/($repo.owner.)/($repo.name)/pulls/($pr)/comments")
|
||||||
|
| from json
|
||||||
|
| select user.login body diff_hunk
|
||||||
|
| rename user comment diff )
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue