From fe1174bf16634565784c2f3da8755c867cf80fc6 Mon Sep 17 00:00:00 2001 From: Maxim Uvarov Date: Thu, 18 May 2023 19:07:47 +0800 Subject: [PATCH] add the `no-strip` flag to the clip command (#9216) # Description `ansi strip` (used in the clip command by default) removes tab symbols, which is sometimes not useful (for example, when using the `[[a b]; [1 2]] | to tsv | clip` command). Therefore, I added a flag to prevent using `ansi strip` in the clip command. # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-std/lib/mod.nu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/nu-std/lib/mod.nu b/crates/nu-std/lib/mod.nu index b262e99af..7d21b142c 100644 --- a/crates/nu-std/lib/mod.nu +++ b/crates/nu-std/lib/mod.nu @@ -111,13 +111,14 @@ def check-clipboard [ export def clip [ --silent: bool # do not print the content of the clipboard to the standard output --no-notify: bool # do not throw a notification (only on linux) + --no-strip: bool # do not strip ANSI escape sequences from a string --expand (-e): bool # auto-expand the data given as input ] { let input = ( $in | if $expand { table --expand } else { table } | into string - | ansi strip + | if $no_strip {} else { ansi strip } ) match $nu.os-info.name {