filterfish / smith2

A complete rewrite of Smith
12 stars 7 forks source link

add group support to list command #19

Closed DylanGriffith closed 9 years ago

DylanGriffith commented 10 years ago

After I though about it I realised that the all option didn't conflict with group, so we would still need to consider that. I tried to do it the way you suggested and not load agents then filter afterward, but couldn't think of an easy way to do that which didn't involve duplicating the filter for state after.

The main issue was that both #find_by_name and #state returned arrays (and not the fancy agents enumerable), thus they could not be chained in any obvious way, so the filtering using a #select seemed inevitable. Though it may, I suppose, have been possible to get the array and construct another fancy enumerable from that.

I have tested this locally to much delicious success:

$ bin/smithctl list -la
total 3
stopping  753ebf3b-fd1a-49c1-8418-1e1c34da860e  95204  2014/10/16 17:12:35  (agent dead)  InstagramPostPersistAgent
running   39acbcbd-3d21-448b-bd0b-0e5723aa6ad3  14315  2014/11/12 16:31:56                InstagramPostgresPostPersistAgent
running   0713076a-6c66-4fad-a392-8be79e2fc5ca  81593  2014/11/13 08:20:03                InstagramPostsUserReportAgent

$ bin/smithctl list -l
total 2
running  39acbcbd-3d21-448b-bd0b-0e5723aa6ad3  14315  2014/11/12 16:31:56    InstagramPostgresPostPersistAgent 
running  0713076a-6c66-4fad-a392-8be79e2fc5ca  81593  2014/11/13 08:20:03    InstagramPostsUserReportAgent

$ bin/smithctl list -lg satin
total 1
running  39acbcbd-3d21-448b-bd0b-0e5723aa6ad3  14315  2014/11/12 16:31:56    InstagramPostgresPostPersistAgent 

$ bin/smithctl list -lag satin
total 2
stopping  753ebf3b-fd1a-49c1-8418-1e1c34da860e  95204  2014/10/16 17:12:35  (agent dead)  InstagramPostPersistAgent
running   39acbcbd-3d21-448b-bd0b-0e5723aa6ad3  14315  2014/11/12 16:31:56                InstagramPostgresPostPersistAgent
DylanGriffith commented 10 years ago

fixes https://github.com/filterfish/smith2/issues/14

filterfish commented 9 years ago

Merged.