Open backwardspy opened 3 weeks ago
These are the commands that are available without doing a use std
in the repl.
https://github.com/nushell/nushell/blob/b1cf0e258dc103f28b23190e495a2695bb0f9c97/crates/nu-std/src/lib.rs#L54-L67
You'll notice that show
isn't in there but its alias shells
is.
❯ shells --help
Display current working directories.
Usage:
> show
Flags:
-h, --help - Display the help message for this command
However, I do agree that this stuff should work better.
Yes, it's confused me in the past as well, and I only now think I'm starting to grok it. Put slightly differently, those aliases are defined in std
. It's possible for an alias in a module to:
Those aliases are imported at startup, but the original commands they point to are not.
However, I do agree that this stuff should work better.
+1 ;-)
(Rough thinking without any validation or research) Perhaps the original commands should also be imported? Or just reverse the alias and command names?
interesting, thanks for the added context! that does make sense. so this isn't a bug, just some potentially confusing help messages.
I also don't like how shells --help
lists show
in the usage above. If I had my way, it would look more like this.
❯ shells --help
Display current working directories.
Usage:
> shells (an alias to `show`)
Flags:
-h, --help - Display the help message for this command
Another thing that bothers me is that help shells
is different than shells --help
.
❯ help shells
Alias for `show`
Alias: shells
Expansion:
show
❯ shells --help
Display current working directories.
Usage:
> show
Flags:
-h, --help - Display the help message for this command
As @fdncred noted, this issue applies to all commands in the shells
category. Not only are they exposed in a "prelude", these aliases are presented like other built-ins in documentation, too.
Oddly, the officials docs pages for dexit
and enter
on the Wayback Machine). Example screenshots showing the resolved drop
and add
commands in the Usage
section[^1]:
[^1]: A keen observer might note that there's other incorrect help, i.e., the dexit
has a Subcommands
section that appears to be incorrectly re-used from the drop
built-in. I've filed an issue for this at #13278.
Oddly, the officials docs pages for dexit and enter on the Wayback Machine). Example screenshots showing the resolved drop and add commands in the Usage section1:
I'm guessing that this is because exit
and enter
used to be normal nushell Rust commands. Changing them to the stdlib, which is all nushell scripting, was one of our first attempts at moving commands from Rust to nushell scripting. Although, it could be because the code has changed so much and there's a bug too.
Describe the bug
i've been learning nushell, and today i stumbled across something a little confusing.
i was running
help shells
to see if it supported any options. this is what it showed me:i hadn't realised there was an alias, so i tried it:
my understanding is that nushell will always prefer a built-in command over an external one unless i use
^
, yet here it is telling me that it's failed as an external command, but available as a built-in one?nushell implies that this command exists in some other contexts:
but there is no available help for it:
i'm not sure if this is actually a bug or not, but at the least perhaps some of this output could be more helpful in explaining what i'm looking at.
How to reproduce
run
show
in nushell 0.94.2Expected behavior
i expected nu to either tell me that such a command does not exist, or run the built-in command by that name.
Screenshots
No response
Configuration
Additional context
edit: i've just noticed that
next
andprev
give the same output, after looking at this: https://github.com/nushell/nushell/blob/b1cf0e258dc103f28b23190e495a2695bb0f9c97/crates/nu-std/std/dirs.nu#L24-L96