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

nu ['-c' 'version'] doesn't work as expected #5056

Closed
hustcer opened this issue Apr 1, 2022 · 2 comments · Fixed by #5695
Closed

nu ['-c' 'version'] doesn't work as expected #5056

hustcer opened this issue Apr 1, 2022 · 2 comments · Fixed by #5695
Labels
🐛 bug Something isn't working
Milestone

Comments

@hustcer
Copy link
Contributor

hustcer commented Apr 1, 2022

Describe the bug

nu ['-c' 'version'] doesn't work as expected

How to reproduce

It's found that

> let args = [ 
  '-c' 
  'version'
] 
> nu $args

works, but nu ['-c' 'version'] doesn't work

$> nu ['-c' 'version']
Error:
  × No such file or directory (os error 2)

Expected behavior

nu ['-c' 'version'] should output just the same as nu -c version

Screenshots

No response

Configuration

key value
version 0.60.1
branch main0
short_commit a00f5c89
commit_hash a00f5c89c2c80fb4ad3459a94e58462cb5008012
commit_date 2022-04-01 01:44:39 +00:00
build_os macos-x86_64
rust_version rustc 1.59.0
cargo_version cargo 1.59.0
pkg_version 0.60.1
build_time 2022-04-01 09:50:37 +08:00
build_rust_channel release
features dataframe, default, trash, which, zip
installed_plugins gstat

Additional context

In bash we can do:

nu \
  -c 'version'

to break command in multiple lines, if nu ['-c' 'version'] works we can break lines easier:

nu -c [
    'custom-command'
    '--long-flag-a=a'
    '--long-flag-b=b'
    positionArg1
    arg2
]
@hustcer hustcer added the 🐛 bug Something isn't working label Apr 1, 2022
@hustcer hustcer added this to the v0.62.0 milestone Apr 9, 2022
@hustcer hustcer added the 0.62 label Apr 15, 2022
@hustcer hustcer modified the milestones: v0.62.0, v0.63 May 3, 2022
@hustcer hustcer removed the 0.62 label May 3, 2022
@hustcer hustcer removed this from the v0.63.0 milestone May 25, 2022
@WindSoilder WindSoilder mentioned this issue Jun 2, 2022
3 tasks
@kubouch
Copy link
Contributor

kubouch commented Jun 2, 2022

The

nu -c [
    'custom-command'
    '--long-flag-a=a'
    '--long-flag-b=b'
    positionArg1
    arg2
]

does not work by design since the -c flag supports a string argument only. You'd need to do nu -c ([...] | str collect ' '). The list in an external command signature is interpreted as individual arguments instead of one long string which is an important feature.

What I see as a problem is that

nu ['-c' 'version']

does not work while

nu (['-c' 'version'])

does. We might want to fix that one.

@hustcer
Copy link
Contributor Author

hustcer commented Jun 2, 2022

@kubouch Fine, That’s acceptable

@hustcer hustcer added this to the v0.64.0 milestone Jun 6, 2022
fdncred pushed a commit that referenced this issue Dec 10, 2023
# Description

This repeats #8268 to make all command usage strings start with an
uppercase letter and end with a period per #5056

Adds a test to ensure that commands won't regress

Part of #5066

# User-Facing Changes

Command usage is now consistent

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Automatic documentation updates
hardfau1t pushed a commit to hardfau1t/nushell that referenced this issue Dec 14, 2023
…1278)

# Description

This repeats nushell#8268 to make all command usage strings start with an
uppercase letter and end with a period per nushell#5056

Adds a test to ensure that commands won't regress

Part of nushell#5066

# User-Facing Changes

Command usage is now consistent

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Automatic documentation updates
dmatos2012 pushed a commit to dmatos2012/nushell that referenced this issue Feb 20, 2024
…1278)

# Description

This repeats nushell#8268 to make all command usage strings start with an
uppercase letter and end with a period per nushell#5056

Adds a test to ensure that commands won't regress

Part of nushell#5066

# User-Facing Changes

Command usage is now consistent

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

Automatic documentation updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants