From faf1dac649f4394fd71e648ec9ce87bcada8cf5e Mon Sep 17 00:00:00 2001 From: WriterV2 Date: Mon, 6 Apr 2026 16:33:00 +0200 Subject: Nushell: Fix ripgrep wrapper for piped input --- .config/nushell/config.nu | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to '.config/nushell') diff --git a/.config/nushell/config.nu b/.config/nushell/config.nu index 99f311b..d94dcda 100644 --- a/.config/nushell/config.nu +++ b/.config/nushell/config.nu @@ -866,13 +866,12 @@ $env.config = { alias _rg = rg export def --wrapped rg [...rest] { - mut result = '' - if ($in != null) { - $result = (print $in | _rg ...$rest) + let piped = $in + if ($piped | describe) == 'string' { + $piped | _rg ...$rest } else { - $result = (_rg ...$rest) - } - $result | lines | parse "{File}:{Result}" | update Result { |row| ($row.Result | str replace --all $rest.0 $'(ansi gb)($rest.0)(ansi reset)') } | sort-by File + _rg ...$rest | lines | parse "{File}:{Result}" | update Result { |row| ($row.Result | str replace --all $rest.0 $'(ansi gb)($rest.0)(ansi reset)') } | sort-by File + } } -- cgit v1.2.3