stdlib: fix the clip command with integer values (#8898)

# Description
this PR fixes the `std clip` command which would not copy integer data
😮
and, as all the input data is now treated as raw `string` with the
`table | into string` conversion, i've removed the "stripped" print when
done clipping the data 👍

 from the `main` on which this PR is based (cbedc8403)
> **Note**
> from inside`cargo run` and with a `use std clip`
- ✔️ `'foo' | clip`
- ✔️ `ls | get 0 | clip`
-  `123 | clip`
 
# User-Facing Changes
✔️ from the tip of the PR branch
> **Note**
> from inside`cargo run` and with a `use std clip`
- ✔️ `'foo' | clip`
- ✔️ `ls | get 0 | clip`
- ✔️ `123 | clip`

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
-  `toolkit test`
-  `toolkit test stdlib`

# After Submitting
```
$nothing
```
This commit is contained in:
Antoine Stevan 2023-04-20 18:59:34 +02:00 committed by GitHub
parent 393f424f1c
commit d339902dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,10 +108,7 @@ 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)
] {
let input = $in
let input = if ($input | describe) == "string" {
$input | ansi strip
} else { $input }
let input = ($in | table | into string | ansi strip)
match $nu.os-info.name {
"linux" => {
@ -144,12 +141,7 @@ export def clip [
if not $silent {
print $input
print --no-newline $"(ansi white_italic)(ansi white_dimmed)saved to clipboard"
if ($input | describe) == "string" {
print " (stripped)"
}
print --no-newline $"(ansi reset)"
print $"(ansi white_italic)(ansi white_dimmed)saved to clipboard(ansi reset)"
}
if (not $no_notify) and ($nu.os-info.name == linux) {