Comments

clemens.tolboom’s picture

There is afaik no need for a module / info file. Correct me if I'm wrong.

drush dl drush_entity should place the code into .drush/drush_entity right?

damiankloip’s picture

Yep, I think if it can be downloaded straight to the .drush dir that makes sense. It is a drush extension and not a module after all! Sounds like a sensible plan to me.

damiankloip’s picture

Version: » 7.x-5.x-dev
Status: Active » Needs review

No module etc... or anything. I have pushed these changes to a new 7.x-5.x-el branch that provides the entity-list command. I have also added a couple of line of meta info to hook_drush_help so we get 'Entity commands' instead of 'All commands in entity'.

clemens.tolboom’s picture

I added the command to the test script. It fails on using format.

drush --format=properties el
Unknown option: --format.  See `drush help entity-list` for information on usage.

Not sure what to do with it now. So I leave the --format out to just make it work for the test script.

I merged 7.x-5.x into 7.x-5.x-el

The data collected with drush el can almost be reproduces with
drush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class"
apart from the entity count. We could add the count stats to _drush_entity_info() result thus make the table output 'just' a format. That opens the possibility to use --fields=_drush/count and we can then add a --colomns for simple tables.

What do you think?

clemens.tolboom’s picture

I added the count to _drush_entity_info.

drush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class,drush/count"

provides for all data for drush entity-list.

I think this is a nice addition to make a more general table output. Ie

drush er node 12 --format=table --fields="x,y,z"

should be possible later on.

We can now remove _drush_entity_count_table() right?

damiankloip’s picture

I definitely agree a more general table output would be good as this is usually one of the easiest ways to view data.

So are we planning to just remove entity-list? I don't mind either way, I just think that I would get slightly annoyed if I wanted an entity overview I needed to run something like:

drush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class,drush/count"

That might get a little tedious? When I could just have a command like "drush el" to provide this summary. I guess what I mean is we should have options to customise the output but I like this idea of the entity-list quick and easy summary of info.

Maybe we could have a "drush etr --summary" command instead?

damiankloip’s picture

Just looked at the new changes, having the count in _drush_entity_get_info makes alot of sense. I like it :)

The only thing is that _drush_entity_get_info doesn't do a count currently for the info if the drupal major version is below 7 like in _drush_entity_count_table(). We should probably add this in too so we can mirror (kind of!) the functionality we can do with entities?

damiankloip’s picture

I have just added this to _drush_entity_get_info on the 7.x-5.x-el branch. So $entity_info[$key]['drush']['count'] works for versions below 7.

Edit: Oh, and just removed _drush_entity_count_table function now all functionality is in _drush_entity_get_info :)

clemens.tolboom’s picture

Status: Needs review » Fixed

Cool.

What I was trying to say using --fields is we could use

  // drush etr `drush etr` --fields="bundles/*/label,label,base table,revision table,fieldable,entity class,controller class,drush/count"
  $fields = "bundles/*/label,label,base table,revision table,fieldable,entity class,controller class,drush/count";
  $paths = split(",", $fields);
  foreach ($entities as $entity_type => $info) {
    $entities[$entity_type] = _drush_entity_filter_fields($entities[$entity_type], $paths);
  }

for arbitrary columns to print ie a node in a table format.

The current status of difference between entity-list versus entity-type-read is now only in the formatters.

I have create #1428568: Add use of table format for more then just entity-list for this.

I merged to 7.x-5.x ... thanks!!!

damiankloip’s picture

Ah, sorry. I get what you mean now :) that seems like a good idea.

clemens.tolboom’s picture

Status: Fixed » Closed (fixed)
clemens.tolboom’s picture

Issue summary: View changes

Updated issue summary.