-
Notifications
You must be signed in to change notification settings - Fork 2.1k
compile failed: can not parse string positional parameter/flags correctly #8788
Copy link
Copy link
Closed
Description
Describe the bug
╰─❯ open test.nu
def main [
word:string
--option (-o):string=''
--flag (-f)
] {
print $'word=($word) option=($option) flag=($flag)'
}
╰─❯ nu test.nu hello -f -o '1'
Error: nu::parser::type_mismatch
× Type mismatch during operation.
╭─[<commandline>:1:1]
1 │ main hello -f -o 1
· ┬
· ╰── expected string, found number-like value (hint: use quotes or backticks)
╰────
╰─❯ nu test.nu '1' -f -o '1'
Error: nu::parser::type_mismatch
× Type mismatch during operation.
╭─[<commandline>:1:1]
1 │ main 1 -f -o 1
· ┬
· ╰── expected string, found number-like value (hint: use quotes or backticks)
╰────How to reproduce
as above
Expected behavior
print word=hello option=1 flag=true
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.78.0 |
| branch | |
| commit_hash | |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.69.0-nightly (f77bfb733 2023-03-01) |
| rust_channel | nightly-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.69.0-nightly (9880b408a 2023-02-28) |
| build_time | 2023-04-06 11:19:15 +08:00 |
| build_rust_channel | release |
| features | default, zip |
| installed_plugins |
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels