Ok, crazy patch :)

when now doing 'drush ctex module_name' you first get a selection:

Select to proceed
 [0]  :  Cancel            
 [1]  :  Export everything 
 [2]  :  Make selection 

So, now you can cancel the export, export all exportables or start the selection screen. It will go into an infinite loop untill you select cancel. By default, all exportables will be selected. It is split up into screens. First one shows all tables with a count of selected exportables.

Number of exportables selected: 23
By default all exportables are selected. Select a table to deselect exportables. Select "cancel" to start writing the files.

Select a table. Select cancel to start writing files.
 [0]  :  Cancel                                                        
 [1]  :  File Entity (file_display) (9)                                
 [2]  :  Panels (panels_renderer_pipeline) (1)                         
 [3]  :  Page manager existing pages (page_manager_existing_pages) (1) 
 [4]  :  Display suite (ds_layout_settings) (1)                        
 [5]  :  Display suite (ds_fields) (1)                                 
 [6]  :  Views (views_view) (10)  

Cancelling wil start writing, choosing a table presents a multiple select.

Exportables from Views (views_view)
Select exportables.
 [0]   :  Cancel                                       
 [1]   :  Archive (archive) (selected)                 
 [2]   :  Backlinks (backlinks) (selected)             
 [3]   :  Front page (frontpage) (selected)            
 [4]   :  Glossary (glossary) (selected)               
 [5]   :  Recent comments (comments_recent) (selected) 
 [6]   :  Taxonomy term (taxonomy_term) (selected)     
 [7]   :  Tracker (tracker) (selected)                 
 [8]   :  workbench_current_user (selected)            
 [9]   :  workbench_edited (selected)                  
 [10]  :  workbench_recent_content (selected)          
 [11]  :  Done 

You can (de)select until you're ok. Cancelling will keep the state before you started, choosing done will update the selected variables.
Let's hope we can get a couple of reviewers on this for feedback!



damiankloip’s picture

That is a pretty cool idea, I like the wizard like approach!

However, as I have recently found out in drush_entity depending on user interactions/decisions become more painful if you want to automate/chain/pipe commands together. Should we have the ability to add additional args so a group of exports or a single exportable can be output (either to file or not etc...).

This kind of approach works pretty well for us in drush entity, as you get massive amounts of flexibility with what you can do with commands. Everyone has a slightly different workflow.

I'm not slating this patch at all (Just to clarify!) I think it's an awesome idea, I just think this should be the outcome if no additional arguments for exportables are supplied? I am happy to have a look at creating a patch if you think it's a good idea.

merlinofchaos’s picture

Status: Needs review » Needs work

I agree that we should always be able to automate; that's the whole point of drush. A patch to address that would be welcome.