From fcdc7f3d8317163865a54b0b71edb77ef5bde388 Mon Sep 17 00:00:00 2001
From: Tyarel8 <98483313+Tyarel8@users.noreply.github.com>
Date: Tue, 5 Aug 2025 20:21:23 +0200
Subject: [PATCH] fix(std/help): trim example results and fix binary examples
(#16354)
# Description
Added trimming to the example results like in the normal `help`, and
also changed the logic for binary examples to remove the weird spacing.
- Before:
- After:
# User-Facing Changes
# Tests + Formatting
# After Submitting
---
crates/nu-std/std/help/mod.nu | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/crates/nu-std/std/help/mod.nu b/crates/nu-std/std/help/mod.nu
index 04713702ac..2f26ffc75a 100644
--- a/crates/nu-std/std/help/mod.nu
+++ b/crates/nu-std/std/help/mod.nu
@@ -708,8 +708,9 @@ def build-command-page [command: record] {
(if not ($example.result | is-empty) {
$example.result
| table -e
- | to text
- | if ($example.result | describe) == "binary" { str join } else { lines }
+ | str trim --right
+ | lines
+ | skip until { is-not-empty }
| each {|line|
$" ($line)"
}