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.

CommentFileSizeAuthor
#16 drush-improved-help.patch2.2 KBgreg.1.anderson

Comments

greg.1.anderson’s picture

Another thought would be to differentiate sections from commands by adding a "." on the beginning of command sections (e.g. drush help .sql vs drush help sql-sync).

hanoii’s picture

I 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?

greg.1.anderson’s picture

Regarding drush help sql and drush 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-sync is just understood to be shorthand for drush help sql sql-sync, and therefore drush help features give help on the 'features' section, and drush help features features gives 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".

hanoii’s picture

no, 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.

greg.1.anderson’s picture

Formerly, "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.

hanoii’s picture

Now 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.

greg.1.anderson’s picture

My thought was that this would only apply to help; the command would still be drush sql-sync, and help, in long-form, would be drush help sql sql-sync. Since help knows that sql-sync is part of the sql namespace, drush help sql-sync would still work as a synonym for drush 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 sql to give an overview of all of the sql commands (like today's drush help --filter=sql), and drush help could list all of the available namespaces (core, sql, pm, etc.). A list of all of the commands could be provided by drush help commands or drush help --pipe.

hanoii’s picture

I 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...

greg.1.anderson’s picture

No, we won't be going back to commands with spaces in them. It had too many issues with backend invoke, redispatching, autocomplete, etc.

greg.1.anderson’s picture

Component: Code » PM (dl, en, up ...)
Assigned: Unassigned » greg.1.anderson

Assigning to myself for later consideration.

moshe weitzman’s picture

Priority: Normal » Minor

We also have topics now. In general, I think there is not much to do on this issue.

jonhattan’s picture

Several 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:

drush
drush help

Show help on commands within a commandfile:

drush help commands core
drush help commands features

Show help on a command:

drush help command watchdog-show
drush help command features

/* and for compatible with current implementation */
drush help watchdog-show
drush help features

Perhaps with dashes: help-commands and help-command

I prefer that way rather than drush help features features discussed above.

moshe weitzman’s picture

I'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.

moshe weitzman’s picture

I 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.

greg.1.anderson’s picture

Status: Active » Fixed

I'm satisfied to call this "fixed" by recent improvements to drush help and drush topic.

greg.1.anderson’s picture

Status: Fixed » Needs review
StatusFileSize
new2.2 KB

I just thought of a really easy way to provide this: drush help --list or drush help --filter (with no value) gives the user a choice of commandfiles to view.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

I 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.

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

Committed per #17.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.