Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors detected from nushell/nu_scripts #142

Open
14 of 15 tasks
blindFS opened this issue Nov 16, 2024 · 1 comment
Open
14 of 15 tasks

Errors detected from nushell/nu_scripts #142

blindFS opened this issue Nov 16, 2024 · 1 comment

Comments

@blindFS
Copy link
Contributor

blindFS commented Nov 16, 2024

Command

  • - executable path as the command head
    • example: ~/test.nu arg1 arg2
  • - val_interpolated as the external command head
    • example: ^$"($cmd)"

Identifier

  • - command identifier too restricted, example:
    • g++ foo.cpp
    • 7z
    • export module foo/
  • - variable identifier, example:
    • $0
  • - record key should allow more punctuations
    • example: {echo%: foo}

Redirection

  • - append ops, example 1 o>> foo
  • - values redirection, example 1 + 1 o> foo
  • - redirect pipes should be single token, example cmd1 e>| cmd2

Parameters/command args

  • - single - should be allowed as short_flag
  • - short_flag_equals_value: -flag=foo
  • - unquoted as default value in parameters: --flag=name:string@"nu-complete flag"
  • - list types with completion info: --flag(-f): list<string@"nu-complete flag">
  • - spread types: Support the spread operator #98

Misc

  • - variable as cell_path: $foo.$bar.$baz
  • - unquoted strings with more punctuations: echo foo"bar"
@fdncred
Copy link
Collaborator

fdncred commented Nov 16, 2024

if anyone wants to work on any one of these specific issues, let me know and i can put your name by the item.

fdncred pushed a commit that referenced this issue Nov 17, 2024
This PR should fix #98, as well as several easy problems mentioned in
#142.

I think I should keep each PR focused for better traceability, so the
trickier issues related to identifier and parameters are left for later.

## Command

* [x] - val_interpolated as the external command head
  - example: `^$"($cmd)"`

## Redirection

* [x] - append ops, example `1 o>> foo`
* [x] - values redirection, example `1 + 1 o> foo`
* [x] - redirect pipes should be single token, example `cmd1 e>| cmd2`

## Parameters/command args

* [x] - spread types

## Misc

* [x] - variable as cell_path: `$foo.$bar.$baz`, it turns out `$bar` is
treated as string instead.

## Changes made to the existing test cases

- `unquoted` node in `decl_use` renamed to `val_string` to align with
`stmt_source`
- cases that should fail now simply tagged with `:error` since we
generally don't care where the error occurs
fdncred pushed a commit that referenced this issue Nov 18, 2024
This PR fixes those parameter/flag related issues in #142
fdncred pushed a commit that referenced this issue Nov 19, 2024
This PR fixes most of the remaining issues related to identifiers as
reported in #142 .

```nushell
# values
null
7b
nan
# commands
g++
7z
7mss
truee
```

It's still not perfect, nushell handles special characters like `-, #,
., ()` in identifiers very dynamically.
I think this is the time to finally resort to an external scanner for
further accuracy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants