FEATURE: add --expand to std clip (#8970)

# Description
i use `std clip` to copy everything from `nushell`.
however i have the auto-expand on tables enabled and when i use `clip`
on large tables, it does not copy what i see but the collapsed data => i
have to edit the line and add `| table --expand` manually, which is a
pain to do regularly 😱

in this PR, i just add `--expand` to `std clip` to automatically expand
the data before copying it 😋

# User-Facing Changes
exploring the `Cargo.toml` of `nushell` with auto-expand, one might see
```
> open Cargo.toml | get package.metadata.binstall.overrides
╭────────────────────────┬───────────────────╮
│                        │ ╭─────────┬─────╮ │
│ x86_64-pc-windows-msvc │ │ pkg-fmt │ zip │ │
│                        │ ╰─────────┴─────╯ │
╰────────────────────────┴───────────────────╯
```
but then
```
open Cargo.toml | get package.metadata.binstall.overrides | clip
```
would only copy
```
╭────────────────────────┬──────────────────╮
│ x86_64-pc-windows-msvc │ {record 1 field} │
╰────────────────────────┴──────────────────╯
```
...

now 
```
open Cargo.toml | get package.metadata.binstall.overrides | clip --expand
```
will copy the expanded record 👍 

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

# After Submitting
```
$nothing
```
This commit is contained in:
Antoine Stevan 2023-04-28 09:07:38 +02:00 committed by GitHub
parent 3268ecd116
commit 35c8485442
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,8 +107,14 @@ def check-clipboard [
export def clip [ export def clip [
--silent: bool # do not print the content of the clipboard to the standard output --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-notify: bool # do not throw a notification (only on linux)
--expand (-e): bool # auto-expand the data given as input
] { ] {
let input = ($in | table | into string | ansi strip) let input = (
$in
| if $expand { table --expand } else { table }
| into string
| ansi strip
)
match $nu.os-info.name { match $nu.os-info.name {
"linux" => { "linux" => {