To help manage long help files, this patch separates commands into categories. help --sort removes the categories and puts everything in one long list again. Works with help --html.

Comments

moshe weitzman’s picture

could you pls attach output of categoried help or --html output? so we can visualize the change.

greg.1.anderson’s picture

StatusFileSize
new108.55 KB

Here is some output with some Drupal modules w/ drush integration included (--html output attached):

Execute a drush command. Run `drush help [command]` to view command-specific help. 
Run `drush topic` to read even more documentation.

Global options (see `drush topic` for the full list):
 -r <path>, --root=<path>                  Drupal root directory to use (default: 
                                           current directory)                     
 -l http://example.com,                    URI of the drupal site to use (only    
 --uri=http://example.com                  needed in multisite environments)      
 -v, --verbose                             Display extra information about the    
                                           command.                               
 -d, --debug                               Display even more information,         
                                           including internal messages.           
 -y, --yes                                 Assume 'yes' as answer to all prompts  
 -n, --no                                  Assume 'no' as answer to all prompts   
 -s, --simulate                            Simulate all relevant actions (don't   
                                           actually change the system)            
 -p, --pipe                                Emit a compact representation of the   
                                           command for scripting.                 
 -h, --help                                This help system.                      
 --version                                 Show drush version.                    
 --php                                     The absolute path to your PHP          
                                           intepreter, if not 'php' in the path.  


Core drush commands: (core)
 cache-clear (cc)      Clear a specific cache, or all drupal caches.              
 core-cli (cli)        Enter a new shell optimized for drush use.                 
 core-cron (cron)      Run all cron hooks in all active modules for specified     
                       site.                                                      
 core-rsync (rsync)    Rsync the Drupal tree to/from another server using ssh.    
 core-status (status,  Provides a birds-eye view of the current Drupal            
 st)                   installation, if any.                                      
 core-topic (topic)    Read detailed documentation on a given topic.              
 drupal-directory      Return path to a given module/theme directory.             
 (dd)                                                                             
 help                  Print this help message. See `drush help help` for more    
                       options.                                                   
 image-flush           Flush all derived images for a given style.                
 php-eval (eval, ev)   Evaluate arbitrary php code after bootstrapping Drupal (if 
                       available).                                                
 php-script (scr)      Run php script(s).                                         
 search-index          Index the remaining search items without wiping the index. 
 search-reindex        Force the search index to be rebuilt.                      
 search-status         Show how many items remain to be indexed out of the total. 
 self-update           Update drush to the latest version, if available.          
 (selfupdate)                                                                     
 site-alias (sa)       Print site alias records for all known site aliases and    
                       local sites.                                               
 site-install (si)     Install Drupal along with modules/themes/configuration     
                       using the specified install profile.                       
 site-upgrade (sup)    Run a major version upgrade for Drupal (e.g. Drupal 6 to   
                       Drupal 7).                                                 
 test-clean            Clean temporary tables and files.                          
 test-run              Run tests. Note that you must use the --uri option.        
 updatedb (updb)       Apply any database updates required (as with running       
                       update.php).                                               
 variable-delete       Delete a variable.                                         
 (vdel)                                                                           
 variable-get (vget)   Get a list of some or all site variables and values.       
 variable-set (vset)   Set a variable.                                            
 version               Show drush version.                                        
 watchdog-delete       Delete watchdog messages.                                  
 (wd-del, wd-delete)                                                              
 watchdog-list         Show available message types and severity levels. A prompt 
 (wd-list)             will ask for a choice to show watchdog messages.           
 watchdog-show         Show watchdog messages.                                    
 (wd-show, ws)                                                                    

Field commands: (field)
 field-clone           Clone a field and all its instances.                     
 field-create          Create fields and instances. Returns urls for field      
                       editing.                                                 
 field-delete          Delete a field and its instances.                        
 field-info            View information about fields, field_types, and widgets. 
 field-update          Return URL for field editing web page.                   

Project manager commands: (pm)
 pm-disable (dis)      Disable one or more extensions (modules or themes).       
 pm-download (dl)      Download projects from drupal.org or other sources.       
 pm-enable (en)        Enable one or more extensions (modules or themes).        
 pm-info (pmi)         Show detailed info for one or more extensions (modules or 
                       themes).                                                  
 pm-list (pml)         Show a list of available extensions (modules and themes). 
 pm-refresh (rf)       Refresh update status information.                        
 pm-releasenotes       Print release notes for given projects.                   
 (rln)                                                                           
 pm-releases (rl)      Print release information for given projects.             
 pm-uninstall          Uninstall one or more modules.                            
 pm-update (up)        Update Drupal core and contrib projects and apply any     
                       pending database updates (Same as pm-updatecode +         
                       updatedb).                                                
 pm-updatecode (upc)   Update Drupal core and contrib projects to latest         
                       recommended releases.                                     

SQL commands: (sql)
 sql-cli (sqlc)        Open a SQL command-line interface using Drupal's            
                       credentials.                                                
 sql-connect           A string for connecting to the DB.                          
 sql-drop              Drop all tables in a given database.                        
 sql-dump              Exports the Drupal DB as SQL using mysqldump or equivalent. 
 sql-query (sqlq)      Execute a query against the site database.                  
 sql-sync              Copy and import source database to target database.         
                       Transfers via rsync.                                        

User commands: (user)
 user-add-role (urol)  Add a role to the specified user accounts.               
 user-block (ublk)     Block the specified user(s).                             
 user-cancel (ucan)    Cancel a user account with the specified name.           
 user-create (ucrt)    Create a user account with the specified name.           
 user-information      Print information about the specified user(s).           
 (uinf)                                                                         
 user-login (uli)      Display a one time login link for the given user account 
                       (defaults to uid 1).                                     
 user-password (upwd)  (Re)Set the password for the user account with the       
                       specified name.                                          
 user-remove-role      Remove a role from the specified user accounts.          
 (urrol)                                                                        
 user-unblock (uublk)  Unblock the specified user(s).                           

All commands in devel: (devel)
 devel-download        Downloads the FirePHP library from http://firephp.org/.    
 devel-reinstall       Disable, Uninstall, and Install a list of projects.        
 (dre)                                                                            
 devel-token (token)   List available tokens                                      
 fn-hook (fnh, hook)   List implementations of a given hook and explore source of 
                       specified one.                                             
 fn-view (fnv)         Show the source of specified function or method.           

All commands in features: (features)
 features              List all the available features for your site.  
 features-export       Export a feature from your site into a module.  
 features-revert (fr)  Revert a feature module on your site.           
 features-revert-all   Revert all enabled feature module on your site. 
 (fr-all, fra)                                                         
 features-update (fu)  Update a feature module on your site.           
 features-update-all   Update all feature modules on your site.        
 (fu-all, fua)                                                         

Other commands: (devel_generate,hacked,path_redirect_generate)
 generate redirects    Creates URL redirects.                             
 generate-content      Creates content.                                   
 (genc)                                                                   
 generate-taxonomy     Creates taxonomy.                                  
 (gent)                                                                   
 generate-users        Creates users.                                     
 (genu)                                                                   
 hacked details        Show the Hacked! report about a specific project.  
 hacked diff           Output a unified diff of the project specified.    
 hacked list-projects  List all projects that can be analysed by Hacked! 
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks real nice.

  1. Possible indentation snafu
    -      drush_print_pipe($pipe);
    +    sort($pipe);
    
  2. Oh no. We have to name 'pm' now. This patch goes with 'Project Manager'. I could also go for Package Manager. Any opinions? I guess project is slightly better since package is a term we don't use now. I want pm to be thought of like apt-get and friends, but we are not there yet.
greg.1.anderson’s picture

We recently renamed 'pm' from 'package manager' to 'project manager' in the comments (same time we did the 'extensions' renaming). Looked briefly for the issue # and didn't see it.

greg.1.anderson’s picture

Status: Reviewed & tested by the community » Fixed

Committed; re-open if you want me to adjust terms or sorting or anything.

On sorting:

"Core" is always first, then commands with titles appear, sorted by title, then "All commands in xxx", then "Other commands", always last. (Command files with less than four commands go in "other commands" rather than "all commands in xxx", unless they have a title.) Maybe "All commands in xxx" should be sorted in with the other commands, but sorted by xxx. It seems good as it is, too, though.

I will update drush api with docs on how to declare help category titles.

Status: Fixed » Closed (fixed)

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