Remove trim in favor of str trim (#2560)

This commit is contained in:
Chris Gillespie
2020-09-16 12:59:32 -07:00
committed by GitHub
parent d05f9b3b1e
commit 50cbf91bc5
16 changed files with 14 additions and 263 deletions

View File

@ -1,65 +0,0 @@
# trim
Trim leading and following whitespace from text data
## Example
```shell
> echo " Hello world"
Hello world
```
```shell
> echo " Hello world" | trim
Hello world
```
Trim can also be passed a list or table of text, for which it will trim each item individually.
It will fail if any element in the list or table is not of type String.
```shell
> open greetings.json | to json
[" hi ", " hello ", " wassup "]
```
```shell
> open greetings.json | trim | to json
["hi", "hello", "wassup"]
```
```shell
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}"
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# │ crate_name │ version │ description
───┼────────────────────┼─────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────
0 │ shells │ "0.2.0" │ Sugar-coating for invoking shell commands directly from Rust.
1 │ ion-shell │ "0.0.0" │ The Ion Shell
2 │ shell-words │ "0.1.0" │ Process command line according to parsing rules of UNIX shell
3 │ nu │ "0.5.0" │ A shell for the GitHub era
4 │ dotenv-shell │ "1.0.1" │ Launch a new shell (or another program) with your loaded dotenv
5 │ shell_completion │ "0.0.1" │ Write shell completion scripts in pure Rust
6 │ shell-hist │ "0.2.0" │ A CLI tool for inspecting shell history
7 │ tokei │ "10.0.1" │ A utility that allows you to count code, quickly.
8 │ rash-shell │ "0.1.0" │ A bourne-compatible shell inspired by dash
9 │ rust_keylock_shell │ "0.10.0" │ Shell access to the rust-keylock. rust-keylock is a password manager with goals
│ │ │ to be Secure, …
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
```shell
> cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}" | trim
━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# │ crate_name │ version │ description
───┼────────────────────┼──────────┼──────────────────────────────────────────────────────────────────────────────────
0 │ shells │ "0.2.0" │ Sugar-coating for invoking shell commands directly from Rust.
1 │ ion-shell │ "0.0.0" │ The Ion Shell
2 │ shell-words │ "0.1.0" │ Process command line according to parsing rules of UNIX shell
3 │ nu │ "0.5.0" │ A shell for the GitHub era
4 │ dotenv-shell │ "1.0.1" │ Launch a new shell (or another program) with your loaded dotenv
5 │ shell_completion │ "0.0.1" │ Write shell completion scripts in pure Rust
6 │ shell-hist │ "0.2.0" │ A CLI tool for inspecting shell history
7 │ tokei │ "10.0.1" │ A utility that allows you to count code, quickly.
8 │ rash-shell │ "0.1.0" │ A bourne-compatible shell inspired by dash
9 │ rust_keylock_shell │ "0.10.0" │ Shell access to the rust-keylock. rust-keylock is a password manager with goals
│ │ │ to be Secure, …
━━━┷━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

View File

@ -12,7 +12,7 @@ pivot_mode = "auto"
ctrlc_exit = false
complete_from_path = true
rm_always_trash = true
prompt = "echo [ $(ansi gb) $(pwd) $(ansi reset) \"(\" $(ansi cb) $(do -i { git rev-parse --abbrev-ref HEAD | trim }) $(ansi reset) \")\" $(char newline) $(ansi yb) $(date --format \"%m/%d/%Y %I:%M:%S%.3f %p\" --raw) $(ansi reset) \"> \" ] | str collect"
prompt = "echo [ $(ansi gb) $(pwd) $(ansi reset) \"(\" $(ansi cb) $(do -i { git rev-parse --abbrev-ref HEAD | str trim }) $(ansi reset) \")\" $(char newline) $(ansi yb) $(date --format \"%m/%d/%Y %I:%M:%S%.3f %p\" --raw) $(ansi reset) \"> \" ] | str collect"
# for each of the options in the color_config section, you are able to set
# the color alone or with one of the following attributes.