Improvements to drush help were discussed in #734270: Convenient aliases for running a command on groups of sites and #628996: Concurrently execute a single drush command on multiple sites.
A drush man page was suggested. This could easily be done, but people who download drush or check it out from cvs (most users) would have to copy the man file to the appropriate directory, and non-cygwin Windows users would be left out. It would be great if the man page existed, and drush was installed via apt-get install drush, but I think an enhancement to the help system would be better.
I might suggest that drush help commands would work like drush help does today, and drush help sql could work the same way that drush help --filter=sql does today. drush help by itself could give some general help and list all of the command sections (core, sql, pm, etc.) and pseudo-sections (commands, aliases, configuration, etc.). Command help could work the same way that it does today; drush help sql-sync.
This would give a lot of flexibility; the only problem would be if someone made a command with the same name as its section, which is actually fairly common (e.g. features). In cases like this, we could perhaps have drush help features both list the commands in the features section, and also print the help for the features command.
Perhaps this is not completely ideal, but if help is to be segmented, it would be better for usability if the commands and sections could be referenced easily.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | drush-improved-help.patch | 2.2 KB | greg.1.anderson |
Comments
Comment #1
greg.1.anderson commentedAnother thought would be to differentiate sections from commands by adding a "." on the beginning of command sections (e.g.
drush help .sqlvsdrush help sql-sync).Comment #2
hanoiiI have been doing some thinking (out of code looking). So for now, just sharing a few thoughts, self-questions, etc.
I like the idea of the sections and how that will help for a possible endless growing list of commands. I don't think a command and a section should share names though. I think those has to be specifically forbidden (but some kind of check in drush).
What happens now if somebody declares a conflicting command?
I also think tried to think of how others strong command line tools work with this (cvs, svn, etc.), and although some similarity, they don't have that much commands.
cvs, on its own, gives a very standard simple help page when run on without any parameters, only telling you how to request more help, so that's probably in the line of the suggestion on this issue.
I have the following thought, which is just that, not sure if it's any better of this and I can expect some kind of big change within the code, but.. what if sections are commands as well, that requires sub commands?
drush sql or drush help sql would give help for the sql command, and the sql command requires subcommands (along with their options). So a sub command would be drush sql sync
Is this just too much?
Comment #3
greg.1.anderson commentedRegarding
drush help sqlanddrush help sql-sync, that is exactly what I had in mind. The thing is, though, that it is common for Drupal modules that implement drush commands to have a command named after their module name (e.g. features), and there are enough of these that I was reluctant to break everyone who did.Maybe
drush help sql-syncis just understood to be shorthand fordrush help sql sql-sync, and thereforedrush help featuresgive help on the 'features' section, anddrush help features featuresgives help on the features command? That would resolve the ambiguity, and people would only rarely need to use the longer form.Perhaps that's what you meant above; I wasn't sure if the space in "sql sync" was supposed to be "sql sql-sync" or just "sql-sync".
Comment #4
hanoiino, I was thinking actually of a sync subcommand of sql, so only "drush sql sync", not "drush sql sql-sync"
I am not sure what the features command do, but say it lists features,
it would have to be something like:
"drush features list" rather than "drush features features", only standing in my way of thinking.
Comment #5
greg.1.anderson commentedFormerly, "drush sql-sync" was "drush sql sync", but we switched from spaces in command names to dashes for clarity.
It would be possible to require "features" to rename its command to "features-list", but I'm undecided on whether or not that's too burdensome.
Comment #6
hanoiiNow you mentioned it, I remeber that drush sql sync existed, and it seemed natural then.
I read a bit through the namespace issue that moved forward the namespacing of commands back then, and that made sense because "sql sync" was one command. But if you have subcommands, or sections/commands, "drush sql sync" seems a lot more appropriate now. It may seem like a step back, I know, but "drush sql sql-sync" is too redundant.
Comment #7
greg.1.anderson commentedMy thought was that this would only apply to help; the command would still be
drush sql-sync, and help, in long-form, would bedrush help sql sql-sync. Sincehelpknows that sql-sync is part of the sql namespace,drush help sql-syncwould still work as a synonym fordrush help sql sql-sync. The only place that the namespace would be required would be in cases where there was a command with the same name as its namespace (e.g. features, as suggested in #3).This would pave the way for
drush help sqlto give an overview of all of the sql commands (like today'sdrush help --filter=sql), anddrush helpcould list all of the available namespaces (core, sql, pm, etc.). A list of all of the commands could be provided bydrush help commandsordrush help --pipe.Comment #8
hanoiiI see, well, ok. And knowing my thinking was way off only help, going back to drush sql sync (but now considering sql as a commend and sync as a subcommand), is something completely out of the question here? any thoughts on that. I know it's probably is, but now that I got to think of it...
Comment #9
greg.1.anderson commentedNo, we won't be going back to commands with spaces in them. It had too many issues with backend invoke, redispatching, autocomplete, etc.
Comment #10
greg.1.anderson commentedAssigning to myself for later consideration.
Comment #11
moshe weitzman commentedWe also have topics now. In general, I think there is not much to do on this issue.
Comment #12
jonhattanSeveral times it has raised that the help page was getting bloated. This issue could fix this. Here's a proposal:
Show a general message on how to obtain more help and a list of available commandfiles:
Show help on commands within a commandfile:
Show help on a command:
Perhaps with dashes: help-commands and help-command
I prefer that way rather than
drush help features featuresdiscussed above.Comment #13
moshe weitzman commentedI'm not too happy about the length of the help page but I'm hesitant to remove anything :). I think that requiring a grouping in order to view command list is frustrating. The whole reason you are doing the list is because you can't remember if it is site-aliases or core-sa or pm-aliases or whatever. Nobody likes to hunt for this stuff.
I actually tinkered with moving the Global options off the Help page. We would add a message informing user how to learn more about them. But often you need --url just to get anything working so maybe we have to list the most common on the main page still.
Comment #14
moshe weitzman commentedI eventually did move rarely used global options into a topic so the help page is a bit slimmer now. I'm currently not to inclined to pursue this but am open to discussion.
Comment #15
greg.1.anderson commentedI'm satisfied to call this "fixed" by recent improvements to drush help and drush topic.
Comment #16
greg.1.anderson commentedI just thought of a really easy way to provide this:
drush help --listordrush help --filter(with no value) gives the user a choice of commandfiles to view.Comment #17
moshe weitzman commentedI like it. I'd say we can do without the new --list option and just document the behavior of --filter without a value. This parallels --result-file. After that, lets commit.
Comment #18
greg.1.anderson commentedCommitted per #17.