return Error if get meet nothing and without "i"#7002
Conversation
22e30ab to
03be1ee
Compare
|
And I think the error is a bit mixing, both get and select, should show that there are empty cell ,so cannot get message, I think |
49ba1b4 to
3dbe1fe
Compare
|
Hi, can you please add some examples to this PR? It's not obvious to me what this PR is fixing. It would help to see:
|
Log: relate issue nushell#6969
3dbe1fe to
864e42e
Compare
|
Emm, since the action of select is changed, so if still need this change described in this issue? |
I agree. I'm interested what others think too. |
|
@Decodetalkers The errors on |
#7639 pull request is here now |
|
Let's give it a try since I merged the other PR as well. Thanks! |
|
I'm not sure we landed in a good state after merging this PR. The error messages also need work; they should look more like this: I took a quick look and think that fixing that error message is going to be difficult due to the way this was implemented. |
Because in the related issue, author think in select, nushell will check empty cell, but get will not check, so I think get can also have the ability to check empty cell.. so add the key Oh , I have seen your pull request , add |
…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.


Description
relate issue #6969
before:

after

Tests
Make sure you've done the following:
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspace --features=extrato check that all the tests passDocumentation