1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00

feat(gh-completions): view inlined-comments (#1106)

Adds a command to see comments in github pullrequest.

You can test it as follows

![image](https://github.com/user-attachments/assets/ab76dad8-81f3-432e-9aca-c27227928f96)

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?

![image](https://github.com/user-attachments/assets/06dbd03c-e508-48bb-88c3-61809370f5a5)
This commit is contained in:
Francesc Elies 2025-04-28 13:48:55 +02:00 committed by GitHub
parent 9560df9370
commit b442c96ec2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -547,3 +547,24 @@ export extern "gh variable" [
--repo(-R) # Select another repository using the [HOST/]OWNER/REPO format
--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 )
}