Merged
Conversation
sophiajt
pushed a commit
that referenced
this pull request
Nov 11, 2019
* ci(github): lowercase ${{ github.actor }}
* ci(github): fix robot username
* fix(ci): fix tag name on suffixed version
ahkrr
pushed a commit
to ahkrr/nushell
that referenced
this pull request
Jun 24, 2021
Implement primitive word-jumping
elferherrera
pushed a commit
to elferherrera/nushell
that referenced
this pull request
Feb 7, 2022
Removed file_id in Span, compact file sources
3 tasks
3 tasks
sophiajt
pushed a commit
that referenced
this pull request
Nov 23, 2022
# Description BEFORE: ``` 〉ls | size Error: nu::shell::pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #22:1:1] 1 │ ls | size · ──┬─ · │╰── value originates from here · ╰── expected: string ╰──── 〉ls | sort-by SIZE Error: nu:🐚:column_not_found (link) × Cannot find column ╭─[entry #17:1:1] 1 │ ls | sort-by SIZE · ───┬─── · │╰── value originates here · ╰── cannot find column ╰──── 〉[4kb] | path join 'b' Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #6:1:1] 1 │ [4kb] | path join 'b' · ──┬── · │╰── value originates from here · ╰── expected: string or record ╰──── ``` AFTER: ``` 〉ls | size Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #1:1:1] 1 │ ls | size · ─┬ ──┬─ · │ ╰── expected: string · ╰── value originates from here ╰──── 〉ls | get 0 | sort-by SIZE Error: nu:🐚:column_not_found (link) × Cannot find column ╭─[entry #2:1:1] 1 │ ls | get 0 | sort-by SIZE · ─┬ ───┬─── · │ ╰── cannot find column 'SIZE' · ╰── value originates here ╰──── 〉[4kb] | path join 'b' Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #1:1:1] 1 │ [4kb] | path join 'b' · ──┬── ────┬──── · │ ╰── expected: string or record · ╰── value originates from here ╰──── ``` (Hey, anyone noticed that there's TWO wordings of "value originates from here" in this codebase………?) # User-Facing Changes See above. # 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 --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace --features=extra` to check that all tests pass # 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.
sophiajt
added a commit
that referenced
this pull request
Dec 7, 2022
# Description Adds improved errors for when a user uses a bashism that nu doesn't support. fixes #7237 Examples: ``` Error: nu::parser::shell_andand (link) × The '&&' operator is not supported in Nushell ╭─[entry #1:1:1] 1 │ ls && ls · ─┬ · ╰── instead of '&&', use ';' or 'and' ╰──── help: use ';' instead of the shell '&&', or 'and' instead of the boolean '&&' ``` ``` Error: nu::parser::shell_oror (link) × The '||' operator is not supported in Nushell ╭─[entry #8:1:1] 1 │ ls || ls · ─┬ · ╰── instead of '||', use 'try' or 'or' ╰──── help: use 'try' instead of the shell '||', or 'or' instead of the boolean '||' ``` ``` Error: nu::parser::shell_err (link) × The '2>' shell operation is 'err>' in Nushell. ╭─[entry #9:1:1] 1 │ foo 2> bar.txt · ─┬ · ╰── use 'err>' instead of '2>' in Nushell ╰──── ``` ``` Error: nu::parser::shell_outerr (link) × The '2>&1' shell operation is 'out+err>' in Nushell. ╭─[entry #10:1:1] 1 │ foo 2>&1 bar.txt · ──┬─ · ╰── use 'out+err>' instead of '2>&1' in Nushell ╰──── help: Nushell redirection will write all of stdout before stderr. ``` # User-Facing Changes **BREAKING CHANGES** This removes the `&&` and `||` operators. We previously supported by `&&`/`and` and `||`/`or`. With this change, only `and` and `or` are valid boolean operators. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
kubouch
pushed a commit
that referenced
this pull request
Dec 9, 2022
# Description Fixes #7407. ``` /home/gabriel/CodingProjects/nushell〉if false { 'a' } else { $foo } 12/09/2022 08:14:48 PM Error: nu::parser::variable_not_found (link) × Variable not found. ╭─[entry #1:1:1] 1 │ if false { 'a' } else { $foo } · ──┬─ · ╰── variable not found ╰──── ``` # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
kubouch
pushed a commit
that referenced
this pull request
Dec 10, 2022
# Description Closes #7059. Rather than generate a new Record each time $env.config is accessed (as described in that issue), instead `$env.config = ` now A) parses the input record, then B) un-parses it into a clean Record with only the valid values, and stores that as an env-var. The reasoning for this is that I believe `config_to_nu_record()` (the method that performs step B) will be useful in later PRs. (See below) As a result, this also "fixes" the following "bug": ``` 〉$env.config = 'butts' $env.config is not a record 〉$env.config butts ``` ~~Instead, `$env.config = 'butts'` now turns `$env.config` into the default (not the default config.nu, but `Config::default()`, which notably has empty keybindings, color_config, menus and hooks vecs).~~ This doesn't attempt to fix #7110. cc @Kangaxx-0 # Example of new behaviour OLD: ``` 〉$env.config = ($env.config | merge { foo: 1 }) $env.config.foo is an unknown config setting 〉$env.config.foo 1 ``` NEW: ``` 〉$env.config = ($env.config | merge { foo: 1 }) Error: × Config record contains invalid values or unknown settings Error: × Error while applying config changes ╭─[entry #1:1:1] 1 │ $env.config = ($env.config | merge { foo: 1 }) · ┬ · ╰── $env.config.foo is an unknown config setting ╰──── help: This value has been removed from your $env.config record. 〉$env.config.foo Error: nu:🐚:column_not_found (link) × Cannot find column ╭─[entry #1:1:1] 1 │ $env.config = ($env.config | merge { foo: 1 }) · ──┬── · ╰── value originates here ╰──── ╭─[entry #2:1:1] 1 │ $env.config.foo · ─┬─ · ╰── cannot find column 'foo' ╰──── ``` # Example of new errors OLD: ``` $env.config.cd.baz is an unknown config setting $env.config.foo is an unknown config setting $env.config.bar is an unknown config setting $env.config.table.qux is an unknown config setting $env.config.history.qux is an unknown config setting ``` NEW: ``` Error: × Config record contains invalid values or unknown settings Error: × Error while applying config changes ╭─[C:\Users\Leon\AppData\Roaming\nushell\config.nu:267:1] 267 │ abbreviations: true # allows `cd s/o/f` to expand to `cd some/other/folder` 268 │ baz: 3, · ┬ · ╰── $env.config.cd.baz is an unknown config setting 269 │ } ╰──── help: This value has been removed from your $env.config record. Error: × Error while applying config changes ╭─[C:\Users\Leon\AppData\Roaming\nushell\config.nu:269:1] 269 │ } 270 │ foo: 1, · ┬ · ╰── $env.config.foo is an unknown config setting 271 │ bar: 2, ╰──── help: This value has been removed from your $env.config record. Error: × Error while applying config changes ╭─[C:\Users\Leon\AppData\Roaming\nushell\config.nu:270:1] 270 │ foo: 1, 271 │ bar: 2, · ┬ · ╰── $env.config.bar is an unknown config setting ╰──── help: This value has been removed from your $env.config record. Error: × Error while applying config changes ╭─[C:\Users\Leon\AppData\Roaming\nushell\config.nu:279:1] 279 │ } 280 │ qux: 4, · ┬ · ╰── $env.config.table.qux is an unknown config setting 281 │ } ╰──── help: This value has been removed from your $env.config record. Error: × Error while applying config changes ╭─[C:\Users\Leon\AppData\Roaming\nushell\config.nu:285:1] 285 │ file_format: "plaintext" # "sqlite" or "plaintext" 286 │ qux: 2 · ┬ · ╰── $env.config.history.qux is an unknown config setting 287 │ } ╰──── help: This value has been removed from your $env.config record. ``` # User-Facing Changes See above. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
fdncred
pushed a commit
that referenced
this pull request
Dec 13, 2022
# Description Fixes #6773. ``` /home/gabriel/CodingProjects/nushell〉ls -r 12/12/2022 02:57:35 PM Error: nu::parser::unknown_flag (link) × The `ls` command doesn't have flag `-r`. ╭─[entry #1:1:1] 1 │ ls -r · ┬ · ╰── unknown flag ╰──── help: Available flags: --help(-h), --all(-a), --long(-l), --short-names(-s), --full-paths(-f), --du(-d), --directory(-D). Use `--help` for more information. ``` # User-Facing Changes Different error for unknown flag. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
rgwood
pushed a commit
that referenced
this pull request
Dec 16, 2022
# Description Fixes #7494. ``` /home/gabriel/CodingProjects/nushell〉[[{foo: bar}]] | get foo 12/16/2022 12:31:17 PM Error: nu::parser::not_found (link) × Not found. ╭─[entry #1:1:1] 1 │ [[{foo: bar}]] | get foo · ───────┬────── · ╰── did not find anything under this name ╰──── ``` # User-Facing Changes cell paths no longer drill into nested tables. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
rgwood
pushed a commit
that referenced
this pull request
Dec 23, 2022
…ypeMismatch and add spans to every instance of the former (#7217) # Description * I was dismayed to discover recently that UnsupportedInput and TypeMismatch are used *extremely* inconsistently across the codebase. UnsupportedInput is sometimes used for input type-checks (as per the name!!), but *also* used for argument type-checks. TypeMismatch is also used for both. I thus devised the following standard: input type-checking *only* uses UnsupportedInput, and argument type-checking *only* uses TypeMismatch. Moreover, to differentiate them, UnsupportedInput now has *two* error arrows (spans), one pointing at the command and the other at the input origin, while TypeMismatch only has the one (because the command should always be nearby) * In order to apply that standard, a very large number of UnsupportedInput uses were changed so that the input's span could be retrieved and delivered to it. * Additionally, I noticed many places where **errors are not propagated correctly**: there are lots of `match` sites which take a Value::Error, then throw it away and replace it with a new Value::Error with less/misleading information (such as reporting the error as an "incorrect type"). I believe that the earliest errors are the most important, and should always be propagated where possible. * Also, to standardise one broad subset of UnsupportedInput error messages, who all used slightly different wordings of "expected `<type>`, got `<type>`", I created OnlySupportsThisInputType as a variant of it. * Finally, a bunch of error sites that had "repeated spans" - i.e. where an error expected two spans, but `call.head` was given for both - were fixed to use different spans. # Example BEFORE ``` 〉20b | str starts-with 'a' Error: nu::shell::unsupported_input (link) × Unsupported input ╭─[entry #31:1:1] 1 │ 20b | str starts-with 'a' · ┬ · ╰── Input's type is filesize. This command only works with strings. ╰──── 〉'a' | math cos Error: nu:🐚:unsupported_input (link) × Unsupported input ╭─[entry #33:1:1] 1 │ 'a' | math cos · ─┬─ · ╰── Only numerical values are supported, input type: String ╰──── 〉0x[12] | encode utf8 Error: nu:🐚:unsupported_input (link) × Unsupported input ╭─[entry #38:1:1] 1 │ 0x[12] | encode utf8 · ───┬── · ╰── non-string input ╰──── ``` AFTER ``` 〉20b | str starts-with 'a' Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #1:1:1] 1 │ 20b | str starts-with 'a' · ┬ ───────┬─────── · │ ╰── only string input data is supported · ╰── input type: filesize ╰──── 〉'a' | math cos Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #2:1:1] 1 │ 'a' | math cos · ─┬─ ────┬─── · │ ╰── only numeric input data is supported · ╰── input type: string ╰──── 〉0x[12] | encode utf8 Error: nu:🐚:pipeline_mismatch (link) × Pipeline mismatch. ╭─[entry #3:1:1] 1 │ 0x[12] | encode utf8 · ───┬── ───┬── · │ ╰── only string input data is supported · ╰── input type: binary ╰──── ``` # User-Facing Changes Various error messages suddenly make more sense (i.e. have two arrows instead of one). # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Dec 30, 2022
To properly use `ShellError::PipelineMismatch` in
`PipelineData::collect_string_strict()`, `ListStream` needs to carry a
`Span` as well. Introduces the `span` field on `ListStream` and adjusts
the respective `.into_pipeline_data(.*)` methods.
Requires changes to many commands.
This change directly improves the `from ...` error messages:
Before:
```
/home/stefan/nushell: {a:1 b:2} | from nuon
Error: nu::shell::type_mismatch (link)
× Type mismatch
╭─[entry nushell#1:1:1]
1 │ {a:1 b:2} | from nuon
· ────┬────
· ╰── needs string
╰────
```
After:
```
/home/stefan/nushell: {a:1 b:2} | from nuon
Error: nu:🐚:pipeline_mismatch (link)
× Pipeline mismatch.
╭─[entry nushell#1:1:1]
1 │ {a:1 b:2} | from nuon
· ────┬──── ────┬────
· │ ╰── expected: string
· ╰── value originates from here
╰────
```
sholderbach
added a commit
to sholderbach/nushell
that referenced
this pull request
Dec 30, 2022
To properly use `ShellError::PipelineMismatch` in
`PipelineData::collect_string_strict()`, `ListStream` needs to carry a
`Span` as well. Introduces the `span` field on `ListStream` and adjusts
the respective `.into_pipeline_data(.*)` methods.
Requires changes to many commands.
This change directly improves the `from ...` error messages:
Before:
```
/home/stefan/nushell: {a:1 b:2} | from nuon
Error: nu::shell::type_mismatch (link)
× Type mismatch
╭─[entry nushell#1:1:1]
1 │ {a:1 b:2} | from nuon
· ────┬────
· ╰── needs string
╰────
```
After:
```
/home/stefan/nushell: {a:1 b:2} | from nuon
Error: nu:🐚:pipeline_mismatch (link)
× Pipeline mismatch.
╭─[entry nushell#1:1:1]
1 │ {a:1 b:2} | from nuon
· ────┬──── ────┬────
· │ ╰── expected: string
· ╰── value originates from here
╰────
```
rgwood
pushed a commit
that referenced
this pull request
Jan 2, 2023
…nt on #7002) (#7647) # Description This closes #7498, as well as fixes an issue reported in #7002 (comment) BEFORE: ``` 〉[{foo: 'bar'} {}] | get foo Error: nu::shell::column_not_found (link) × Cannot find column ╭─[entry #5:1:1] 1 │ [{foo: 'bar'} {}] | get foo · ────────┬──────── ─┬─ · │ ╰── value originates here · ╰── cannot find column 'Empty cell' ╰──── 〉[{foo: 'bar'} {}].foo ╭───┬─────╮ │ 0 │ bar │ │ 1 │ │ ╰───┴─────╯ ``` AFTER: ``` 〉[{foo: 'bar'} {}] | get foo Error: nu:🐚:column_not_found (link) × Cannot find column ╭─[entry #1:1:1] 1 │ [{foo: 'bar'} {}] | get foo · ─┬ ─┬─ · │ ╰── cannot find column 'foo' · ╰── value originates here ╰──── 〉[{foo: 'bar'} {}].foo Error: nu:🐚:column_not_found (link) × Cannot find column ╭─[entry #3:1:1] 1 │ [{foo: 'bar'} {}].foo · ─┬ ─┬─ · │ ╰── cannot find column 'foo' · ╰── value originates here ╰──── ``` EDIT: This also changes the semantics of `get`/`select` `-i` somewhat. I've decided to leave it like this because it works more intuitively with `default` and `compact`. BEFORE: ``` 〉[{a:1} {b:2} {a:3}] | select -i foo | to nuon null ``` AFTER: ``` 〉[{a:1} {b:2} {a:3}] | select -i foo | to nuon [[foo]; [null], [null], [null]] ``` # User-Facing Changes See above. EDIT: the issue with holes in cases like ` [{foo: 'bar'} {}].foo.0` versus ` [{foo: 'bar'} {}].0.foo` has been resolved. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
Hofer-Julian
pushed a commit
to Hofer-Julian/nushell
that referenced
this pull request
Jan 27, 2023
a first design test
Hofer-Julian
pushed a commit
to Hofer-Julian/nushell
that referenced
this pull request
Jan 27, 2023
Initial draft of website
fdncred
added a commit
that referenced
this pull request
Feb 6, 2023
# Description This PR will help report a bad date that can't be converted where the error message says `* Unable to parse datetime`. This is helpful when you're converting a big table and it fails somewhere that you really can't see. I put it in `[]` so that when it's null, you can see that there should be something there. Before: ``` > 'Tue 1 0' | into datetime Error: nu::shell::datetime_parse_error (link) × Unable to parse datetime ╭─[entry #1:1:1] 1 │ 'Tue 1 0' | into datetime · ────┬──── · ╰── datetime parsing failed ╰──── help: Examples of supported inputs: * "5 pm" * "2020/12/4" * "2020.12.04 22:10 +2" * "2020-04-12 22:10:57 +02:00" * "2020-04-12T22:10:57.213231+02:00" * "Tue, 1 Jul 2003 10:52:37 +0200" ``` After: ``` > 'Tue 1 0' | into datetime Error: nu:🐚:datetime_parse_error (link) × Unable to parse datetime: [Tue 1 0]. ╭─[entry #4:1:1] 1 │ 'Tue 1 0' | into datetime · ────┬──── · ╰── datetime parsing failed ╰──── help: Examples of supported inputs: * "5 pm" * "2020/12/4" * "2020.12.04 22:10 +2" * "2020-04-12 22:10:57 +02:00" * "2020-04-12T22:10:57.213231+02:00" * "Tue, 1 Jul 2003 10:52:37 +0200" ``` # User-Facing Changes New format for the error message. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
Xoffio
pushed a commit
to Xoffio/nushell
that referenced
this pull request
Feb 7, 2023
# Description This PR will help report a bad date that can't be converted where the error message says `* Unable to parse datetime`. This is helpful when you're converting a big table and it fails somewhere that you really can't see. I put it in `[]` so that when it's null, you can see that there should be something there. Before: ``` > 'Tue 1 0' | into datetime Error: nu::shell::datetime_parse_error (link) × Unable to parse datetime ╭─[entry nushell#1:1:1] 1 │ 'Tue 1 0' | into datetime · ────┬──── · ╰── datetime parsing failed ╰──── help: Examples of supported inputs: * "5 pm" * "2020/12/4" * "2020.12.04 22:10 +2" * "2020-04-12 22:10:57 +02:00" * "2020-04-12T22:10:57.213231+02:00" * "Tue, 1 Jul 2003 10:52:37 +0200" ``` After: ``` > 'Tue 1 0' | into datetime Error: nu:🐚:datetime_parse_error (link) × Unable to parse datetime: [Tue 1 0]. ╭─[entry nushell#4:1:1] 1 │ 'Tue 1 0' | into datetime · ────┬──── · ╰── datetime parsing failed ╰──── help: Examples of supported inputs: * "5 pm" * "2020/12/4" * "2020.12.04 22:10 +2" * "2020-04-12 22:10:57 +02:00" * "2020-04-12T22:10:57.213231+02:00" * "Tue, 1 Jul 2003 10:52:37 +0200" ``` # User-Facing Changes New format for the error message. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
fdncred
added a commit
that referenced
this pull request
Feb 9, 2023
# Description This PR does the following: 1. Adds a new command called `view span` - which shows what is at the location of the span parameters 2. Adds a new command called `view` - which just lists all the `view` commands. 3. Renames `view-source` to `view source`. 4. Adds a new command called `view files` - which shows you what files are loaded into nushell's EngineState memory. 5. Added a `Category::Debug` and put these commands (and others) into it. (`inspect` needs to be added to it, but it's not landed yet) Spans are important to nushell. One of their uses is to show where errors are. For instance, in this example, the leader lines pointing to parts of the command line are able to point to `10`, `/`, and `"bob"` because each of those items have a span. ``` > 10 / "bob" Error: nu::parser::unsupported_operation (link) × Types mismatched for operation. ╭─[entry #8:1:1] 1 │ 10 / "bob" · ─┬ ┬ ──┬── · │ │ ╰── string · │ ╰── doesn't support these values. · ╰── int ╰──── help: Change int or string to be the right types and try again. ``` # Examples ## view span Example: ``` > $env.config | get keybindings | first | debug -r ... bunch of stuff span: Span { start: 68065, end: 68090, }, }, ], span: Span { start: 68050, end: 68101, }, }, ], span: Span { start: 67927, end: 68108, }, } ``` To view the last span: ``` > view span 67927 68108 { name: clear_everything modifier: control keycode: char_l mode: emacs event: [ { send: clearscrollback } ] } ``` > To view the 2nd to last span: ``` view span 68065 68090 { send: clearscrollback } ``` > To view the 3rd to last span: ``` view span 68050 68101 [ { send: clearscrollback } ] ``` ## view files ``` > view files ╭────┬───────────────────────────────────────────────────────┬────────┬────────┬───────╮ │ # │ filename │ start │ end │ size │ ├────┼───────────────────────────────────────────────────────┼────────┼────────┼───────┤ │ 0 │ source │ 0 │ 2 │ 2 │ │ 1 │ Host Environment Variables │ 2 │ 6034 │ 6032 │ │ 2 │ C:\Users\a_username\AppData\Roaming\nushell\plugin.nu │ 6034 │ 31236 │ 25202 │ │ 3 │ C:\Users\a_username\AppData\Roaming\nushell\env.nu │ 31236 │ 44961 │ 13725 │ │ 4 │ C:\Users\a_username\AppData\Roaming\nushell\config.nu │ 44961 │ 76134 │ 31173 │ │ 5 │ defs.nu │ 76134 │ 91944 │ 15810 │ │ 6 │ prompt\oh-my.nu │ 91944 │ 111523 │ 19579 │ │ 7 │ weather\get-weather.nu │ 111523 │ 125556 │ 14033 │ │ 8 │ .zoxide.nu │ 125556 │ 127504 │ 1948 │ │ 9 │ source │ 127504 │ 127561 │ 57 │ │ 10 │ entry #1 │ 127561 │ 127585 │ 24 │ │ 11 │ entry #2 │ 127585 │ 127595 │ 10 │ ╰────┴───────────────────────────────────────────────────────┴────────┴────────┴───────╯ ``` `entry #x` will be each command you type in the repl (i think). so, it may be good to filter those out sometimes. ``` > view files | where filename !~ entry ╭───┬───────────────────────────────────────────────────────┬────────┬────────┬───────╮ │ # │ filename │ start │ end │ size │ ├───┼───────────────────────────────────────────────────────┼────────┼────────┼───────┤ │ 0 │ source │ 0 │ 2 │ 2 │ │ 1 │ Host Environment Variables │ 2 │ 6034 │ 6032 │ │ 2 │ C:\Users\a_username\AppData\Roaming\nushell\plugin.nu │ 6034 │ 31236 │ 25202 │ │ 3 │ C:\Users\a_username\AppData\Roaming\nushell\env.nu │ 31236 │ 44961 │ 13725 │ │ 4 │ C:\Users\a_username\AppData\Roaming\nushell\config.nu │ 44961 │ 76134 │ 31173 │ │ 5 │ defs.nu │ 76134 │ 91944 │ 15810 │ │ 6 │ prompt\oh-my.nu │ 91944 │ 111523 │ 19579 │ │ 7 │ weather\get-weather.nu │ 111523 │ 125556 │ 14033 │ │ 8 │ .zoxide.nu │ 125556 │ 127504 │ 1948 │ │ 9 │ source │ 127504 │ 127561 │ 57 │ ╰───┴───────────────────────────────────────────────────────┴────────┴────────┴───────╯ ``` # User-Facing Changes I renamed `view-source` to `view source` just to make a group of commands. No functionality has changed in `view source`. # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
fdncred
added a commit
that referenced
this pull request
Feb 11, 2023
# Description This PR adds a deprecated message to the `benchmark` command. ``` > benchmark Error: nu::shell::deprecated_command (link) × Deprecated command benchmark ╭─[entry #1:1:1] 1 │ benchmark · ────┬──── · ╰── 'benchmark' is deprecated. Please use 'timeit' instead. ╰──── ``` # User-Facing 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # 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.
gaetschwartz
pushed a commit
to gaetschwartz/nushell
that referenced
this pull request
Oct 20, 2023
related to - nushell#10520 # Description this PR is a followup to nushell#10520 and removes the `random integer` command completely, in favor of `random int`. # User-Facing Changes `random integer` has been fully moved to `random int` ```nushell > random integer 0..1 Error: nu::parser::extra_positional × Extra positional argument. ╭─[entry nushell#1:1:1] 1 │ random integer 0..1 · ───┬─── · ╰── extra positional argument ╰──── help: Usage: random ``` # Tests + Formatting tests have been moved from `crates/nu-command/tests/commands/random/integer.rs` to `crates/nu-command/tests/commands/random/int.rs` # After Submitting mention in 0.87.0 release notes
sholderbach
pushed a commit
that referenced
this pull request
Oct 25, 2023
# Description Fixes: #10830 The issue happened during lite-parsing, when we want to put a `LiteElement` to a `LitePipeline`, we do nothing if relative redirection target is empty. So the command `echo aaa o> | ignore` will be interpreted to `echo aaa | ignore`. This pr is going to check and return an error if redirection target is empty. # User-Facing Changes ## Before ``` ❯ echo aaa o> | ignore # nothing happened ``` ## After ```nushell ❯ echo aaa o> | ignore Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #1:1:1] 1 │ echo aaa o> | ignore · ─┬ · ╰── expected redirection target ╰──── ```
sholderbach
pushed a commit
that referenced
this pull request
Nov 7, 2023
# Description `split-by` only works on a `Record`, the error type was updated to match, and now uses a more-specific type. (Two type fixes for the price of one!) The `usage` was updated to say "record" as well # User-Facing Changes * Providing the wrong type to `split-by` now gives an error messages with the correct required input type Previously: ``` ❯ ls | get name | split-by type Error: × unsupported input ╭─[entry #267:1:1] 1 │ ls | get name | split-by type · ─┬─ · ╰── requires a table with one row for splitting ╰──── ``` With this PR: ``` ❯ ls | get name | split-by type Error: nu:🐚:type_mismatch × Type mismatch. ╭─[entry #1:1:1] 1 │ ls | get name | split-by type · ─┬─ · ╰── requires a record to split ╰──── ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting Only generated commands need to be updated --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
WindSoilder
added a commit
that referenced
this pull request
Nov 23, 2023
#10851) # Description Fixes: #10271 Given the following script: ```shell # test.sh echo aaaaa echo bbbbb 1>&2 echo cc ``` This pr makes the following command possible: ```nushell bash test.sh err> /dev/null | lines | each {|line| $line | str length} ``` ## General idea behind the change: When nushell redirect stderr message to external file 1. it take stdout of external stream, and pass this stream to next command, so it won't block next pipeline command from running. 2. relative stderr stream are handled by `save` command These two streams are handled separately, so we need to delegate a thread to `save` command, or else we'll have a chance to hang nushell, we have meet a similar before: #5625. ### One case to consider What if we're failed to save to an external stream? (Like we don't have a permission to save to a file)? In this case nushell will just print a waning message, and don't stop the following scripts from running. # User-Facing Changes ## Before ```nushell ❯ bash test2.sh err> /dev/null | lines | each {|line| $line | str length} aaaaa cc ``` ## After ```nushell ❯ bash test2.sh err> /dev/null | lines | each {|line| $line | str length} ╭───┬───╮ │ 0 │ 5 │ │ 1 │ 2 │ ╰───┴───╯ ``` BTY, after this pr, the following commands are impossible either, it's important to make sure that the implementation doesn't introduce too much costs: ```nushell ❯ echo a e> a.txt e> a.txt Error: × Can't make stderr redirection twice ╭─[entry #1:1:1] 1 │ echo a e> a.txt e> a.txt · ─┬ · ╰── try to remove one ╰──── ❯ echo a o> a.txt o> a.txt Error: × Can't make stdout redirection twice ╭─[entry #2:1:1] 1 │ echo a o> a.txt o> a.txt · ─┬ · ╰── try to remove one ╰──── ```
fdncred
pushed a commit
that referenced
this pull request
Dec 3, 2023
# Description This PR adds checks for ports. This fixes unexpected output similar to the one in the comment #11210 (comment). * before ```console /data/source/nushell> port 65536 99999 41233 ``` * after ```console /data/source/nushell> port 65536 99999 Error: nu::shell::cant_convert × Can't convert to u16. ╭─[entry #1:1:1] 1 │ port 65536 99999 · ──┬── · ╰── can't convert usize to u16 ╰──── help: out of range integral type conversion attempted (min: 0, max: 65535) ``` # User-Facing Changes N/A # Tests + Formatting * [x] add `port_out_of_range` test # After Submitting N/A
fdncred
pushed a commit
that referenced
this pull request
Dec 4, 2023
Trying to call `metadata $env` or `metadata $nu` will throw an error: ```Nushell ~> metadata $nu Error: × Built-in variables `$env` and `$nu` have no metadata ╭─[entry #1:1:1] 1 │ metadata $nu · ─┬─ · ╰── no metadata available ╰──── ```
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
# Description We keep "into decimal" for a release and warn through a message that it will be removed in 0.86. All tests are updated to use `into float` # User-Facing Changes `into decimal` raises a deprecation warning, will be removed soon. Use `into float` as the new functionally identical command instead. ``` ~/nushell> 2 | into decimal Error: × Deprecated command ╭─[entry #1:1:1] 1 │ 2 | into decimal · ──────┬───── · ╰── `into decimal` is deprecated and will be removed in 0.86. ╰──── help: Use `into float` instead 2 ``` # Tests + Formatting Updated --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
fixes nushell#8551 # Description Use `open::commands` function to get list of command available for starting given path. run commands directly, providing environment, until one of them is successful. example of output if start was not successful: ``` ~\code\nushell> start ..\nustart\a.myext 09/12/2023 01:37:55 PM Error: nu::shell::external_command × External command failed ╭─[entry #1:1:1] 1 │ start ..\nustart\a.myext · ─────────┬──────── · ╰── No command found to start with this path ╰──── help: Try different path or install appropriate command Command `cmd /c start "" "..\nustart\a.myext"` failed with exit code: 1 ``` # User-Facing Changes `start` command now provides environment to the external command. This is how it worked in `nu 0.72`, see linked issue. # Tests + Formatting `start` command didn't have any tests and this PR does not add any. Integration-level tests will require setup specific to OS and potentially change global environment on testing machine. For unit-level test it is possible to test `try_commands` function. But is still runs external commands, and robust test will require apriori knowledge which commands are necessary successful to run and which are not.
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
# Description This PR allows the `values` command to support lazy records. closes nushell#10417 ### Before ```nushell sys | values Error: nu::shell::only_supports_this_input_type × Input type not supported. ╭─[entry #1:1:1] 1 │ sys | values · ─┬─ ───┬── · │ ╰── only record or table input data is supported · ╰── input type: record<host: record<name: string, os_version: string, long_os_version: string, kernel_version: string, hostname: string, uptime: duration, boot_time: string, sessions: list<any>>, cpu: table<name: string, brand: string, freq: int, cpu_usage: float, load_average: string, vendor_id: string>, disks: table<device: string, type: string, mount: string, total: filesize, free: filesize, removable: bool, kind: string>, mem: record<total: filesize, free: filesize, used: filesize, available: filesize, swap total: filesize, swap free: filesize, swap used: filesize>, temp: list<any>, net: table<name: string, sent: filesize, recv: filesize>> ╰──── ``` ### After ```nushell ❯ sys | values ╭─┬─────────────────╮ │0│{record 8 fields}│ │1│[table 16 rows] │ │2│[table 1 row] │ │3│{record 7 fields}│ │4│[list 0 items] │ │5│[table 5 rows] │ ╰─┴─────────────────╯ ``` # 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` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `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. -->
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
related to - nushell#9973 - nushell#9918 thanks to @jntrnr and their super useful tips on this PR, i learned about the parser + evaluation, so 🙏 # Description because we already have `null` as the value of the type `nothing` and as a followup to the two other attempts of mine, i propose to remove the redundant `$nothing` built-in variable 😋 this PR is the first step, deprecating `$nothing`. a followup PR will remove it altogether and wait for 0.87 👍 ⚙️ **details**: a new `NOTHING_VARIABLE_ID = 3` has been added, parsing `$nothing` will create it, finally a `Value::Nothing` will be produced and a warning will be reported. this PR already fixes the `toolkit.nu` module so that it does not throw a bunch of warnings each time 👌 # User-Facing Changes `$nothing` is now deprecated and will be removed in 0.87 ```nushell > $nothing Error: × Deprecated variable ╭─[entry #1:1:1] 1 │ $nothing · ────┬─── · ╰── `$nothing` is deprecated and will be removed in 0.87. ╰──── help: Use `null` instead ``` # Tests + Formatting tests have been updated, especially - `nothing_fails_string` - `nothing_fails_int` which use a variable called `nil` now to make sure `nothing` does not support cell paths 👍 # After Submitting classic deprecation mention 👍
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
related to - nushell#9373 - nushell#8639 might be able to close nushell#8639? # Description "can't follow stream paths" errors have always been a bit scary and obnoxious because they give no information about what happens... in this PR i try to slightly improve the error message by telling if the stream was empty or not and give span information when available. # User-Facing Changes ```nushell > update value (get value) Error: nu::shell::incompatible_path_access × Data cannot be accessed with a cell path ╭─[entry #1:1:1] 1 │ update value (get value) · ─┬─ · ╰── empty pipeline doesn't support cell paths ╰──── ``` ```nushell > ^echo "foo" | get 0 Error: nu:🐚:incompatible_path_access × Data cannot be accessed with a cell path ╭─[entry nushell#2:1:1] 1 │ ^echo "foo" | get 0 · ──┬─ · ╰── external stream doesn't support cell paths ╰──── ``` # Tests + Formatting # After Submitting
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
follow-up to - nushell#10566 # Description this PR deprecates the use of `def-env` and `export def-env` these two core commands will be removed in 0.88 # User-Facing Changes using `def-env` will give a warning ```nushell > def-env foo [] { print "foo" }; foo Error: × Deprecated command ╭─[entry #1:1:1] 1 │ def-env foo [] { print "foo" }; foo · ───┬─── · ╰── `def-env` is deprecated and will be removed in 0.88. ╰──── help: Use `def --env` instead foo ``` # Tests + Formatting # After Submitting
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
related to - nushell#10478 # Description this PR is the followup removal to nushell#10478. # User-Facing Changes `$nothing` is now an undefined variable, unless define by the user. ```nushell > $nothing Error: nu::parser::variable_not_found × Variable not found. ╭─[entry #1:1:1] 1 │ $nothing · ────┬─── · ╰── variable not found. ╰──── ``` # Tests + Formatting # After Submitting mention that in release notes
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
related to - nushell#10520 # Description this PR is a followup to nushell#10520 and removes the `random integer` command completely, in favor of `random int`. # User-Facing Changes `random integer` has been fully moved to `random int` ```nushell > random integer 0..1 Error: nu::parser::extra_positional × Extra positional argument. ╭─[entry #1:1:1] 1 │ random integer 0..1 · ───┬─── · ╰── extra positional argument ╰──── help: Usage: random ``` # Tests + Formatting tests have been moved from `crates/nu-command/tests/commands/random/integer.rs` to `crates/nu-command/tests/commands/random/int.rs` # After Submitting mention in 0.87.0 release notes
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
# Description Fixes: nushell#10830 The issue happened during lite-parsing, when we want to put a `LiteElement` to a `LitePipeline`, we do nothing if relative redirection target is empty. So the command `echo aaa o> | ignore` will be interpreted to `echo aaa | ignore`. This pr is going to check and return an error if redirection target is empty. # User-Facing Changes ## Before ``` ❯ echo aaa o> | ignore # nothing happened ``` ## After ```nushell ❯ echo aaa o> | ignore Error: nu::parser::parse_mismatch × Parse mismatch during operation. ╭─[entry #1:1:1] 1 │ echo aaa o> | ignore · ─┬ · ╰── expected redirection target ╰──── ```
hardfau1t
referenced
this pull request
in hardfau1t/nushell
Dec 14, 2023
# Description `split-by` only works on a `Record`, the error type was updated to match, and now uses a more-specific type. (Two type fixes for the price of one!) The `usage` was updated to say "record" as well # User-Facing Changes * Providing the wrong type to `split-by` now gives an error messages with the correct required input type Previously: ``` ❯ ls | get name | split-by type Error: × unsupported input ╭─[entry nushell#267:1:1] 1 │ ls | get name | split-by type · ─┬─ · ╰── requires a table with one row for splitting ╰──── ``` With this PR: ``` ❯ ls | get name | split-by type Error: nu:🐚:type_mismatch × Type mismatch. ╭─[entry #1:1:1] 1 │ ls | get name | split-by type · ─┬─ · ╰── requires a record to split ╰──── ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting Only generated commands need to be updated --------- Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds initial support for where and skip.