nushell: Some commands that require a subcommand (like `config`) output their `help` when run as-is, but others (like `from`) don't
Describe the bug
See title.
The problematic commands that don’t are from, to and query.
query doesn’t even seem to exist without its subcommand.
How to reproduce
〉config
Usage:
> config
Subcommands:
config env - Edit nu environment configurations
config nu - Edit nu configurations
config reset - Reset nushell environment configurations to default, and saves old config files in the config location as oldconfig.nu and oldenv.nu
Flags:
-h, --help - Display this help message
〉from
〉to
〉query
Invalid parameter(s)
QUERY { PROCESS | SESSION | TERMSERVER | USER }
〉which query
╭───┬───────┬───────────────────────────────┬──────────╮
│ # │ arg │ path │ built-in │
├───┼───────┼───────────────────────────────┼──────────┤
│ 0 │ query │ C:\Windows\system32\query.exe │ false │
╰───┴───────┴───────────────────────────────┴──────────╯
Expected behavior
I expect all commands that require subcommands to output their help when run without a subcommand.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.70.0 |
| branch | |
| commit_hash | 9ef65dcd692b502d7476b1787247fae8638c2f0c |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.64.0 (a55dd71d5 2022-09-19) |
| rust_channel | stable-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.64.0 (387270bc7 2022-09-16) |
| pkg_version | 0.70.0 |
| build_time | 2022-10-18 18:55:02 +00:00 |
| build_rust_channel | release |
| features | database, dataframe, default, trash, which, zip |
| installed_plugins |
Additional context
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 15 (9 by maintainers)
Commits related to this issue
- Issue #6844 — committed to sigh-gone/nushell by deleted user 6 months ago
- Issue #6844 — committed to sigh-gone/nushell by deleted user 6 months ago
- Issue #6844 — committed to sigh-gone/nushell by deleted user 6 months ago
- issue #6844 — committed to sigh-gone/nushell by deleted user 6 months ago
- issue #6844 — committed to sigh-gone/nushell by deleted user 6 months ago
im having a lot of issues squashing commits. im very sorry. im just going to take a break
not sure, there is
default_context.rsinnu-commandto add new commands but, otherwise, subcommands are detected automatically, e.g. if you define a subcommand forlsrunning
help lswill show thefoosubcommand directly without any extra step 😉i think it’s fine to add
queryin a PR 👍@sigh-gone yeah, i think that’s normal 👌
query dbis there by default, the others should appear once they are registeredlet’s try to just add a new command without changing traits 😉
nu_plugin_queryalready has aquery.rsand ships aquerycommand when registered. so you could try to add aquery.rsnext toquery_db.rstonu-commandand see if it does not conflict with thenu_plugin_queryplugin once registered@sigh-gone i meant that, afaik, there is no implementation of the
Commandtrait for theQuerystruct inquery.rs, which is why it’s not a Nushell command even thoughquery dbis one!if you look at any other Nushell command, e.g.
fromandtoto stay in the topic here, you’ll see implementations of theCommandtrait https://github.com/nushell/nushell/blob/cd0a52cf00a508476574d94f66b0841387df1631/crates/nu-command/src/formats/from/command.rs#L9 https://github.com/nushell/nushell/blob/cd0a52cf00a508476574d94f66b0841387df1631/crates/nu-command/src/formats/to/command.rs#L9but also things like
lshttps://github.com/nushell/nushell/blob/cd0a52cf00a508476574d94f66b0841387df1631/crates/nu-command/src/filesystem/ls.rs#L25