Skip to content

Commit b442c96

Browse files
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)
1 parent 9560df9 commit b442c96

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

custom-completions/gh/gh-completions.nu

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,3 +547,24 @@ export extern "gh variable" [
547547
--repo(-R) # Select another repository using the [HOST/]OWNER/REPO format
548548
--help # Show help for command
549549
]
550+
551+
export def "gh pr view inlined-comments" [
552+
pr?: int
553+
repo?: string # e.g. nushell/nu_scripts
554+
] {
555+
# nushell/nu_scripts/pull/1105
556+
let pr = if ($pr == null) { ^gh pr view --json number | from json | get number } else { $pr }
557+
let repo = if ($repo == null) {
558+
^gh repo view --json name,owner | from json | select owner.login name | rename owner name
559+
} else {
560+
$repo | parse '{owner}/{name}' | get 0
561+
}
562+
563+
( (gh api
564+
-H "Accept: application/vnd.github+json"
565+
-H "X-GitHub-Api-Version: 2022-11-28"
566+
$"/repos/($repo.owner.)/($repo.name)/pulls/($pr)/comments")
567+
| from json
568+
| select user.login body diff_hunk
569+
| rename user comment diff )
570+
}

0 commit comments

Comments
 (0)