You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@fdncred When parse sees quotes, it will try trim_qoutes . I would like to hear your suggestions, how do we want to deal with trim vs not trim, should we give the control back to user to decide by adding a flag in nu config?
We need a string literal quote that gets passed through, which I thought was backticks. How do other shells handle this?
With externals maybe we should just pass through whatever the user specifies as parameters. We'll have to resolve variables but maybe that should be it?
I tested ZSH, the result was the same as nu. As you said, for external command, I feel like we should keep the parameters, but I don't know if this will introduce regression or not
Don't worry. I personally do not know the user case for trimming, I just want to be careful if there is one which I don't know. My point is - I don't want to introduce a new regression just by fixing this one.
BTW, I did remove that trimming code in my local, at least, no test failed
I'm not really sure it's a "keep all the quotes" or "remove all the quotes" type of issue. JT just mentioned this use case.
I think if we don't handle quotes correctly then things like git commit -m "my message" will put the quotes in the commit message
I could not reproduce what JT mentioned `git commit -m "my message"', it did not give me quotes in commit message, are you able to see his issue from your local?
Also, regards to arg '*/*', it is not just a parser issue, when we eval external, what's more:
We trim quotes too
There is a chunk of code specifically takes care of *
Since this thing involves several commits, I will make a summary, and call it out in implementation chat, then you guys could share thoughts there :)
I could not reproduce what JT mentioned `git commit -m "my message"', it did not give me quotes in commit message, are you able to see his issue from your local?
It shouldn't give quotes. Maybe the point is, if all quotes were stripped then I'm not sure "my message" would come through as the commit message. Conversely, if quoting is done wrong it would show quotes in the commit message. This part you've confirmed doesn't happen right now.
@Kangaxx-0@fdncred the PR corrected the issue (thanks btw), however, I am not sure it covers all use cases.
For instance, I ran into a similar problem today when using Azure CLI. All commands in Azure CLI can take a JMESPath to filter on the output like this: az group list --query "[].name". This displays nothing using Nushell (version 0.66) whereas it displays the name of the resource groups using PowerShell. If I remove the --query [].name it works the same in PowerShell and Nushell.
I don't know if I should open another issue, or if this issue should be reopened. Honestly, it is not a big deal for me as I don't need to use this query argument to filter or select, I can use Nushell for that. Yet if this causes a bug here it can also do it in other tools and people that start using Nushell as their primary shell will find it weird that their tools are not always working in Nushell.
@TechWatching Thanks for the feedback. Personally, I'd like to fix any and all issues surrounding external quoting and expansion, but I'm learning that it's not a trivial task to accomplish that. All help is appreciated.
Activity
Kangaxx-0 commentedon Jul 7, 2022
@fdncred When parse sees quotes, it will try
trim_qoutes. I would like to hear your suggestions, how do we want to deal withtrimvs nottrim, should we give the control back to user to decide by adding a flag in nu config?fdncred commentedon Jul 8, 2022
We need a string literal quote that gets passed through, which I thought was backticks. How do other shells handle this?
With externals maybe we should just pass through whatever the user specifies as parameters. We'll have to resolve variables but maybe that should be it?
Kangaxx-0 commentedon Jul 8, 2022
I tested ZSH, the result was the same as nu. As you said, for external command, I feel like we should keep the parameters, but I don't know if this will introduce regression or not
fdncred commentedon Jul 8, 2022
@Kangaxx-0 for me it works in zsh and in fish

Kangaxx-0 commentedon Jul 8, 2022
It's weird, it does not work on Alacritty + tmux for me. Anyway, This is my thought to fix this issue:
false, user is able to decide if they want to trim quotes during parsing ?fdncred commentedon Jul 8, 2022
I know this issue here is a use case for not trimming quotes. What is a use case for trimming quotes?
I'm not against what you're saying, I just don't understand why we'd want to trim them.
Kangaxx-0 commentedon Jul 8, 2022
Don't worry. I personally do not know the user case for trimming, I just want to be careful if there is one which I don't know. My point is - I don't want to introduce a new regression just by fixing this one.
BTW, I did remove that trimming code in my local, at least, no test failed
fdncred commentedon Jul 8, 2022
I'm not really sure it's a "keep all the quotes" or "remove all the quotes" type of issue. JT just mentioned this use case.
I think if we don't handle quotes correctly then things like
git commit -m "my message"will put the quotes in the commit messageKangaxx-0 commentedon Jul 8, 2022
Let me later run some investigations tho
Kangaxx-0 commentedon Jul 8, 2022
I could not reproduce what JT mentioned `git commit -m "my message"', it did not give me quotes in commit message, are you able to see his issue from your local?
Also, regards to arg
'*/*', it is not just a parser issue, when we eval external, what's more:*Since this thing involves several commits, I will make a summary, and call it out in implementation chat, then you guys could share thoughts there :)
fdncred commentedon Jul 9, 2022
It shouldn't give quotes. Maybe the point is, if all quotes were stripped then I'm not sure "my message" would come through as the commit message. Conversely, if quoting is done wrong it would show quotes in the commit message. This part you've confirmed doesn't happen right now.
TechWatching commentedon Jul 28, 2022
@Kangaxx-0 @fdncred the PR corrected the issue (thanks btw), however, I am not sure it covers all use cases.
For instance, I ran into a similar problem today when using Azure CLI. All commands in Azure CLI can take a JMESPath to filter on the output like this:
az group list --query "[].name". This displays nothing using Nushell (version 0.66) whereas it displays the name of the resource groups using PowerShell. If I remove the--query [].nameit works the same in PowerShell and Nushell.I don't know if I should open another issue, or if this issue should be reopened. Honestly, it is not a big deal for me as I don't need to use this query argument to filter or select, I can use Nushell for that. Yet if this causes a bug here it can also do it in other tools and people that start using Nushell as their primary shell will find it weird that their tools are not always working in Nushell.
fdncred commentedon Jul 28, 2022
@TechWatching Thanks for the feedback. Personally, I'd like to fix any and all issues surrounding external quoting and expansion, but I'm learning that it's not a trivial task to accomplish that. All help is appreciated.
Rewrite run_external.rs (#12921)