Repository navigation
Closed
Labels
A:external-commandsIssues related to external commands
Milestone
Description
Describe the bug
The default configuration we current run for Nu has git external signatures on them. Consider the git checkout external signature. If the user wants to run an external command and said external command does not comply with the definition of the git checkout external, it won't let you run it stating you have a command type checking error.
How to reproduce
As I was playing with the nushell repository I wanted to "reset" my work and the way I usually do it is by running: git checkout main .
Nushell throws an error instead saying the . is an extra positional argument.
Expected behavior
I would expect nu allow me to run that external command without this problem.
Screenshots
No response
Configuration
version | transpose key value | to md --pretty 02/26/2022 02:43:46 PM
| key | value |
| ------------------ | ---------------------------------------- |
| version | 0.59.0 |
| branch | main |
| short_commit | 0c3ea636 |
| commit_hash | 0c3ea636fbad037690b6768dede130cab4ec5445 |
| commit_date | 2022-02-25 19:51:31 +00:00 |
| build_os | windows-x86_64 |
| rust_version | rustc 1.59.0 (9d1b2106e 2022-02-23) |
| rust_channel | stable-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.59.0 (49d8809dc 2022-02-10) |
| pkg_version | 0.59.0 |
| build_time | 2022-02-25 16:40:35 -05:00 |
| build_rust_channel | debug |
| features | dataframe, default, trash, which, zip |
| installed_plugins | |
Additional context
No response
Reacted by Herlon Aguiar
Metadata
Metadata
Assignees
Labels
A:external-commandsIssues related to external commands
Activity
sophiajt commentedon Feb 26, 2022
In this case I think we should fix signature rather than make them not checked
andrasio commentedon Feb 26, 2022
I think that would be too soon to do because these commands are not ours and most likely will happen with future external signatures (and per command there are quite many options, arguments, and positionals). To me it looks more ideal to relax the type checking if it doesn't match it as we continue to expand them.
andrasio commentedon Feb 26, 2022
Another alternative is to inform the user (so that it doesn't block) that to bypass it they could run it escaping it
^so^git checkout main .would work.lukexor commentedon Feb 28, 2022
I'm leaning towards relaxing the check myself - external libraries can be updated, making the shell unable to use them and requiring a patch every time the signature of an external changes. git as an example doesn't change that often - but the type checking IS useful for syntax highlighting so is there a balance to be struck here?
Allow the syntax highlighting to indicate that maybe the extra "." is an invalid invocation - but instead let git decide if it actually is or not. I personally would find it more helpful to get an error message or help prompt back from the external command if I passed the wrong arguments rather than nushell giving me something more cryptic and generalized about parameter mismatches.
Add "fall-through" signatures (#7527)