Ensures that non-strings are not unnecessarily quoted#5492
Ensures that non-strings are not unnecessarily quoted#5492merelymyself wants to merge 7 commits intonushell:mainfrom
Conversation
|
@uasi , I think this should fix it - could you take a look? It collects the types and if it is 'math', 'number' or 'int' it sends the negative number on with quotes. |
|
@merelymyself Thank you for the hard work, but I've come to think that simply making quoting smarter does not solve the overall problem (see #5472 (comment) ). It appears it requires the argument evaluation semantics need to be redesigned at a deeper level of the language. Please contact one of the core devs, as I'm just a new-ish contributor. |
|
@uasi I honestly think you might be right, it may be better in the long-run to redesign the argument evaluation semantics. The whole of |
|
I also think I agree with uasi. The problem with the argument parsing we do now is that it feels very much "solve one case but unfortunately break another case". With a rewrite, we can start by making sure we have all the cases we want to cover first, and then make sure the parser and the parts that deal with args all understand it. |
|
how do we move forward on this? should we close this PR and talk about it in design-discussion or land this and continue to try and make it better? |
|
closing this for the moment. |
Description
Intended to resolve issue #5472. By performing rigorous check that a string needs to be escaped.
The primary issue comes with negative numbers.
Tests
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 --all --all-features -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo build; cargo test --all --all-featuresto check that all the tests pass