Skip to content

External signatures should not enforce type checking. #4659

Closed

Description

@andrasio

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

Activity

  1. sophiajt commented on Feb 26, 2022

    @sophiajt
    Contributor

    In this case I think we should fix signature rather than make them not checked

  2. andrasio commented on Feb 26, 2022

    @andrasio
    MemberAuthor

    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.

  3. added
    A:external-commands
    on Feb 26, 2022
  4. andrasio commented on Feb 26, 2022

    @andrasio
    MemberAuthor

    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.

  5. lukexor commented on Feb 28, 2022

    @lukexor

    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.

  6. added this to the v0.61.0 milestone on Mar 10, 2022
  7. removed this from the v0.61.0 milestone on Apr 10, 2022
  8. added a commit that references this issue on Dec 21, 2022
  9. added this to the v0.74 milestone on Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:external-commands

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions