From #1331278: Drush features-add and features-export are confusingly similar, and overly verbose

@Xen when you have a huge site, and you don't memorize the component types, drush fc is useless by itself.

Why don't you like following the pattern of drush cc?

It's not useless. Most of the time you don't need the type anyway. Often you'll know the machine name of something you want to export, so you can do fc %:%stuff% and be golden.

As for why I don't like it:
1. Because it's a wart. As I've already mentioned, other, newer, drush commands either prints an error and exits (drush user-create) or prints a list of options and exits (drush itself) or prints all "things" and exits (drush pmi). Note the 'and exits' pattern. Most Unix command line tools works this way to, like git, which is the other tool most drush using users will be used to. Consistency is good.
2. Because a numbered list is crap usability. It adds an element of mental indirection ("5" is "css-js"), without any logic. For fc it's even worse as the numbering will change all the time.

Add a --sources switch to fc for the occasions where you need the names of sources instead. It can also be used for scripting, witch the numbered list can't.

CommentFileSizeAuthor
#5 features-fcs_command-1487972-5.patch2.16 KBXen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Often you'll know the machine name of something you want to export, so you can do fc %:%stuff%

Which still works just fine. We are just talking about "fc" without arguments here.

My own opinion is that on my sites, where I have a ton of features and components, the output of "fc" to just show everything is worthless. I'm never going to use it. I'd *always* filter it.

What I like about the prompting is that it quickly shows me which components I am using on a particular site. My sites have lots of non-core feature components, so it's a good reminder for me and saves me from typing out some of the longer component names.

I don't see it as a wart. Nobody is forcing you to use "fc" without arguments. You can still use it the way you want it with arguments. You can still use "fc %" to list everything for scripting. Just because most unix tools don't have interaction doesn't mean that all interaction is bad. It's taking a case that is ambiguous (no arguments) and prompting you for more information. "drush pmi" isn't a good example because there is nothing else for it to do other than show everything...there isn't anything you would ever prompt for. I still use "drush cc" prompting myself sometimes.

Just saying: different people have different opinions on this.

tim.plunkett’s picture

If all drush fc did was print out the component types and then exit, that'd be better off than printing EVERYTHING.
I think the numbered list isn't ideal, but its still more useful than the behavior of that patch before my change.

Xen’s picture

@mpotter:

My own opinion is that on my sites, where I have a ton of features and components, the output of "fc" to just show everything is worthless. I'm never going to use it. I'd *always* filter it.

Then by all means filter it. That's part of the point, it encourages people to explore the filtering options. Another issue with the latest behavior is that it kills the immediately useful fe -e to list all exported components, needing them to understand patterns before they can get that feature.

"drush pmi" isn't a good example because there is nothing else for it to do other than show everything..

No, it *is* a good example. If it should follow your logic, it shouldn't list information on all modules, but prompt the user for which module to show information about. It also produces a lot of output if you don't provide any arguments, just like you object to having fc do. It's a prime example of just the behavior I'm advocating.

@tim.plunkett

If all drush fc did was print out the component types and then exit, that'd be better off than printing EVERYTHING.

It's better than the current behavior, but it still adds inconsistency to what the command really does, depending on whether there is an argument or not. Without an argument, the command doesn't do what it says on the tin.

tim.plunkett’s picture

Sure, rewrite my part as drush fcl and make it mirror pml, I'll review that patch. But I don't memorize component names, and neither do the site builders I know that consider the prompt-then-list their favorite part of this feature.

Xen’s picture

Something like this?

Took the liberty of adding in the human friendly name and the module responsible of the feature.

Xen’s picture

Status: Active » Needs review

And the right status too..

hefox’s picture

Status: Needs review » Needs work
+++ b/features.drush.inc
@@ -174,21 +180,30 @@ function drush_features_list() {
+  foreach (module_implements('features_api') as $module) {
+    $components = module_invoke($module, 'features_api');
+    drupal_alter('features_api', $components);
+    foreach ($components as $source => $info) {
+      $rows[] = array($info['name'], $source, $module);
+    }
+  }

use features_get_components

However, I don't think another command is needed. If they want all, they can do drush fc *, right? drush choice seems fine here.

tim.plunkett’s picture

We should document that it's drush fc %.
Chatted with moshe about drush_choice, and he's planning on using it heavily for a bunch of new drush features, and doesn't understand the aversion here.

Xen’s picture

@hefox
That's where I started, but I wanted to get the defining module, and that's the only way to do it currently.

@tim.plunkett
Well, the devs I've chatted with aren't too fond of drush_choice, for the most part. It's fine if you really want to make an interactive app, but it really messes with the Unix way.

hefox’s picture

> That's where I started, but I wanted to get the defining module, and that's the only way to do it currently.

Sounds like altering features_get_component to add a 'module' key would be useful.

While drush is a command line tool, drupallers been encouraging everyone to use it so changing things to be more usable doesn't seem bad.

Xen’s picture

@hefox

Sounds like altering features_get_component to add a 'module' key would be useful.

Yeah.

While drush is a command line tool, drupallers been encouraging everyone to use it so changing things to be more usable doesn't seem bad.

We're encouraging people because of the power drush gives, not because we want them to use drush. There's already a very usable interface, it's the Features UI. The point of the command line tool is to do stuff and get out of the way. drush_choice feels like Clippy: "Hi there, you seem to be looking for a features source, let me help you with that... What'll it be, matey?"