Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #8983 +/- ##
=======================================
Coverage 68.72% 68.73%
=======================================
Files 640 640
Lines 101530 101540 +10
=======================================
+ Hits 69777 69791 +14
+ Misses 31753 31749 -4 |
|
I'm not understanding |
|
.. and that's why we draft PRs! I'll remove that file. |
|
Yes. |
crates/nu-std/lib/help.nu
Outdated
| export def "help commands" [ | ||
| ...command: string@"nu-complete list-commands" # the name of command to get help on | ||
| --find (-f): string # string to find in command names and usage | ||
| --all (-a) # if showing help for single command, display all sections |
There was a problem hiding this comment.
I see that you mentioned this in the PR description, but I think that --verbose is more intuitive. Something like help -a makes me think that I'll get the help for all commands.
There was a problem hiding this comment.
For me, --verbose connotes extra output for debugging when the command is misbehaving. How about --full? Whatever we call it, are you OK with the default being less rather than more sections?
There was a problem hiding this comment.
I don't think --verbose is tied to debugging only. From my experience it represents a flag saying "apply to all possible arguments".
The thing with --full is that then the short flag would conflict with --find.
And yes, I think that the default should be the shortened version.
There was a problem hiding this comment.
That being said, I think it would be a good idea to discuss this with more people in the Discord channel :)
crates/nu-std/lib/help.nu
Outdated
| } else if not ($command | is-empty) { | ||
| let found_command = ($commands | where name == $command) | ||
|
|
||
There was a problem hiding this comment.
I think that the check isn't failing because the PR is still a draft, but you should run rustfmt.
crates/nu-std/lib/help.nu
Outdated
| $nu.scope.commands | where is_extern | select name usage | rename value description | ||
| } | ||
|
|
||
| def help-header [ |
There was a problem hiding this comment.
Could you use colorize instead of adding another command?
There was a problem hiding this comment.
agree, or help-header could use colorize.
There was a problem hiding this comment.
Will use colorize kind of everywhere I can by the time the PR is finalized...
|
I'm not sure about having --all/--verbose flag on One way to make the std help messages more compact would be to reduce the “This Command” section:
Also the examples of the std commands are quite lengthy sometimes, it might be possible to make them shorter. On the other hand, condensing Usage, Flags, Signature and Parameters into one entry, as suggested by this PR, seems too forced and quite confusing to read. To me, the original is more readable. |
|
My feeling is we don't yet cover the most common user help scenario, and
some complexity will have to be added somewhere to do so. But maybe I
shouldn't be changing the default behavior and should add it elsewhere?
Current help is attuned to the "research" scenario. User wants to learn
something new, perhaps a deep dive, like "tell me about the `find` command"
or a comparison of options, like "what commands are available for dealing
with tables", or even conceptual topics like "how do I debug a script".
Here the user is focused on getting a comprehensive answer, is expecting a
long-form read (multiple pages) and is willing to issue multiple commands,
follow multiple links to get a full answer.
But other times (and *most* times, sez me) user is asking for help to get a
quick reminder on something s/he already knows (or knew), such as "what's
the subcommand of `str` that extracts a portion of the string?" or "what's
the order of arguments for `cp` command?". Here, user is in the midst of
something else and just wants a short answer in a single query.
If you buy the second scenario as being valid, I think that justifies a
different mode of help display. Current help output tends to show
irrelevant detail in this case; and too often, to scroll the relevant
portion off the top of the window causing bigger disruption to user flow
than is necessary.
Independent of the above, I think there will always be differences of
opinion on how to format the information, e.g the parameter block and `this
command` section. Ultimately, I think these should become themable and
configurable (one way might be to define an executable template in `env.nu`,
like we do for prompts). For now, I'll back off.
How about this as a way forward?
* change the sense of the mode flag so it defaults to current style layout,
so `--verbose` ==> `--(c)oncise` or `--(q)uick` and put all my compressed
display goodies behind it.
* revert the parameter block section to its former layout by default. (It
isn't bad, just tall)
* Rationalize the display under `this command` (which might be better
called section `Flags`, see if a horizontal layout works better).
* extern, custom, builtin and plugin are, i think, mutually exclusive, so
could be combined into 1 line
* creates scope does matter for user to know what the effect of a `let`
command would be. Though it's weird to think of it as a property of the
command, it's more a property of the enclosing brackets (conceptual vs
implementation detail; user cares about former).
* I can't think of a case where user cares about subcommand status
either, agree this should be suppressed.
* But keyword and plugin are properties that might matter to user:
keyword as a warning that syntax may not be simple, plugin to trace down
provenance of the command. So I think we should continue to show the value
of the flag for all commands. In default mode, we're not so space
constrained.
…On Thu, Apr 27, 2023 at 2:39 AM Jakub Žádník ***@***.***> wrote:
I'm not sure about having --all/--verbose flag on std help commands, it
adds a lot of complexity to the help system that I’m not sure is worth it.
When a user is seeking help, it needs to be as simple as possible, they
shouldn’t need to remember to pass a flag to get some specific information.
It also makes the output of cmd --help and help cmd different. I'd vote
for having only one level of help messages.
One way to make the std help messages more compact would be to reduce the
“This Command” section:
- I do not understand what "creates scope" means and what implications
it has for the user, could it be omitted?
- If a command is built-in, then it is not custom, so the two lines
can be combined into one
- The information about being a keyword or coming from a plugin could
be omitted if false
- The subcommand information also does not seem useful to me: You can
see it from the command's name and I don’t think user will benefit from
that information, the subcommands are just regular commands from Nushell’s
point of view.
Also the examples of the std commands are quite lengthy sometimes, it
might be possible to make them shorter.
On the other hand, condensing Usage, Flags, Signature and Parameters into
one entry, as suggested by this PR, seems too forced and quite confusing to
read. To me, the original is more readable.
—
Reply to this email directly, view it on GitHub
<#8983 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPBIZH3IZIXF7TQ6U4BP6DXDIIDVANCNFSM6AAAAAAXJAMKRY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
This is worth playing with, would appreciate interim feedback. |
for help commands, add --all to suppress less essential info by default; combine usage, signature and params into one glorious table
… you rename the file and don't change the subcommand name. Fiddle syntax of positional parameters.
--all ==> --verbose for more details
Removing unintended extra file from PR
for help commands, add --all to suppress less essential info by default; combine usage, signature and params into one glorious table
… you rename the file and don't change the subcommand name. Fiddle syntax of positional parameters.
Removing unintended extra file from PR
items is regex, unanchored for --find, but whole word match for command lookup 'this command' -> Flags section in command
|
Almost ready for review, please ignore all the diffs and just install the one modified file to give it a try. Performance is slow (on my system, at least), I think due to terminal ANSI emulation (Gnome terminal on Debian). How is it for you reviewers? Command display for signature, parameters, etc not yet reverted to builtin help. Note that display shows 1 group of flags, params for all signatures. But it's possible for each signature to have different flags and params (though few bultins actually do. Right now |
|
trying to figure out what to test. looking at the diff it's not intuitive.
These were working and are not now.
if there's some specific commands that need testing, please indicate it. |
|
@fdncred after pulling latest |
…examples; --find that matches exactly 1 now shows item, not list
right, that was my point. it's important to keep changes on the latest main because fixes are landed frequently. this also making having a pr with a lot of changes difficult. this is also one of the reasons why i was saying we should break up these scripts into smaller bits. now that kubouch has a draft pr where we can "use" a folder, maybe that will help too? |
|
Thanks for taking a look. I am keeping up with main as recently as this AM.
|
|
.. Would also appreciate feedback from y'all on screen-painting perf. |
imo, we need to use |
|
| def print-help-section [section:string, # section name, skip printing if '' | ||
| body?:string = "" |
There was a problem hiding this comment.
Nit:
| def print-help-section [section:string, # section name, skip printing if '' | |
| body?:string = "" | |
| def print-help-section [ | |
| section: string, # section name, skip printing if '' | |
| body?: string = "" |
There was a problem hiding this comment.
Agree the formatting is not standard. Wish there were a nufmt tool that would handle this automatically.
| if not ($body | is-empty) { | ||
| if $section != "" { | ||
| print-help-header $section | ||
| } else {print ""} |
There was a problem hiding this comment.
Nit:
| } else {print ""} | |
| } else { | |
| print "" | |
| } |
| ...command: string@"nu-complete list-commands" # the name of command to get help on | ||
| --find (-f): string # string to find in command names and usage | ||
| ...item: string@"nu-complete list-commands" # the name of command to get help on | ||
| --find (-f) # show list of matches |
There was a problem hiding this comment.
Question: Could the find pattern used here be based on aliases?
There was a problem hiding this comment.
Do you mean, could I specify an alias here and get help for the command name in the expansion of the alias? If so, no.
I just noticed that built-in help does do this. I actually don't think it should, it's hiding too much information. User typed in an alias, help should tell him/her about that alias.
There was a problem hiding this comment.
Yeah, that's what I meant. I don't have strong feelings about whether it should or should not be supported, but at least it should match what built-in help does.
|
@fncred -- this version is already using As for replicating in stdlib exactly what we already have in the builtin help, I don't see the point of working on that project. Why would we spend time/effort building and maintaining that? What I've done so far on the current PR convinces me Nu language and stdlib are a sufficiently powerful tool to build an improved version of help, and we should be having the discussion about what those improvements should be. |
|
After the discussion with @bobhy yesterday in Discord https://discord.com/channels/601130461678272522/615329862395101194/1102698811312320532, it appears that Bob won't be working on this PR anymore. I'm fine with people working where their passion is. So, we have two options. Someone picks up and finishes this PR or we close it. I've done some testing this morning on my mac and it seems that real-world performance is better here. I'm assuming that's because of the par-each's but I'm not really sure. One of the thing we've been trying to figure out is performance. So that's a +1 for this PR. I've also noticed that there are some regressions for things like help operators. The current main more closely matches our existing help operators written in rust. I really think, one of the big problems is that help.nu is big which makes it more difficult to doing small, bit-sized changes, which in turn may make it more difficult to work on and also makes it more difficult to review. In order to move forward with this PR, I feel like what needs to be done is 100% every help command needs to be tested to see where it's at. An alternate approach is to just steal the par-each parts and put them in a new PR that only addresses performance. That may be the easier approach. What do you think we should do? |
|
@fncred In my defense, I do have passion for improving the help "system" in Nu and am working on #8928 right now. I want to continue by splitting |
📯 announcementthere are great ideas in this PR but a few things make it hard to land right now...
however, this is not the end of these changes! i've linked this PR in #9061, which is easily reachable from the roadmap for future contributors to take the lead on this again 😌 thanks @bobhy for the efforts, @MariaSolOs for reviewing this a bit and all the other members of this discussion. |
Description
Per #8852, improve layout and usability of
std help.There remains some more work before this is ready for prime time:
std help bogondoesn't display any error message (expected command_not_found);std help commands bogondisplays wrong span in its error.std helpmore testable in the first place)$nu.scope, however.User-Facing Changes
std help --allflag (default false; Originally planned to call it--verbosebut thought this was more intuitive).By default,
std help commandsuppresses Category, This Command, Module.before:
Tests + Formatting
__No tests yet for ``std help`!
After Submitting