From b442c96ec2c51d7b8e14387ef94f354cc48f2a2b Mon Sep 17 00:00:00 2001 From: Francesc Elies Date: Mon, 28 Apr 2025 13:48:55 +0200 Subject: [PATCH] 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) --- custom-completions/gh/gh-completions.nu | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/custom-completions/gh/gh-completions.nu b/custom-completions/gh/gh-completions.nu index 30b9738..895c9b6 100644 --- a/custom-completions/gh/gh-completions.nu +++ b/custom-completions/gh/gh-completions.nu @@ -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 ) +}