mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
update char
signature with Table
(#9895)
# Description This PR updates the `char` command to allow `Table` output due to the `--list` parameter. ### Before ```nushell char --list | transpose Error: nu::parser::input_type_mismatch × Command does not support string input. ╭─[entry #6:1:1] 1 │ char --list | transpose · ────┬──── · ╰── command doesn't support string input ╰──── ``` ### After ```nushell ❯ char --list | transpose ╭───┬───────────┬─────────┬─────────┬─────────┬───────────┬─────────┬─────────────┬─────────┬─────────┬─────────┬──────────┬──────────┬──────────┬────────────┬──────────┬─────────────┬──────────┬────────────┬──────────┬──────────┬─────╮ │ # │ column0 │ column1 │ column2 │ column3 │ column4 │ column5 │ column6 │ column7 │ column8 │ column9 │ column10 │ column11 │ column12 │ column13 │ column14 │ column15 │ column16 │ column17 │ column18 │ column19 │ ... │ ├───┼───────────┼─────────┼─────────┼─────────┼───────────┼─────────┼─────────────┼─────────┼─────────┼─────────┼──────────┼──────────┼──────────┼────────────┼──────────┼─────────────┼──────────┼────────────┼──────────┼──────────┼─────┤ │ 0 │ name │ newline │ enter │ nl │ line_feed │ lf │ carriage_re │ cr │ crlf │ tab │ sp │ space │ pipe │ left_brace │ lbrace │ right_brace │ rbrace │ left_paren │ lp │ lparen │ ... │ │ │ │ │ │ │ │ │ turn │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ 1 │ character │ │ │ │ │ │ │ │ │ │ │ │ | │ { │ { │ } │ } │ ( │ ( │ ( │ ... │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ 2 │ unicode │ a │ a │ a │ a │ a │ d │ d │ d a │ 9 │ 20 │ 20 │ 7c │ 7b │ 7b │ 7d │ 7d │ 28 │ 28 │ 28 │ ... │ ╰───┴───────────┴─────────┴─────────┴─────────┴───────────┴─────────┴─────────────┴─────────┴─────────┴─────────┴──────────┴──────────┴──────────┴────────────┴──────────┴─────────────┴──────────┴────────────┴──────────┴──────────┴─────╯ ``` # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> # Tests + Formatting <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect -A clippy::result_large_err` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
This commit is contained in:
parent
d25df9c00b
commit
63103580d2
1 changed files with 5 additions and 1 deletions
|
@ -157,7 +157,10 @@ impl Command for Char {
|
|||
|
||||
fn signature(&self) -> Signature {
|
||||
Signature::build("char")
|
||||
.input_output_types(vec![(Type::Nothing, Type::String)])
|
||||
.input_output_types(vec![
|
||||
(Type::Nothing, Type::String),
|
||||
(Type::Nothing, Type::Table(vec![])),
|
||||
])
|
||||
.optional(
|
||||
"character",
|
||||
SyntaxShape::Any,
|
||||
|
@ -167,6 +170,7 @@ impl Command for Char {
|
|||
.switch("list", "List all supported character names", Some('l'))
|
||||
.switch("unicode", "Unicode string i.e. 1f378", Some('u'))
|
||||
.switch("integer", "Create a codepoint from an integer", Some('i'))
|
||||
.allow_variants_without_examples(true)
|
||||
.category(Category::Strings)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue