mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
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:
parent
393f424f1c
commit
d339902dc6
1 changed files with 2 additions and 10 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue