EmilyDirsh / hotwire-shell

Automatically exported from code.google.com/p/hotwire-shell
Other
0 stars 0 forks source link

sort for object stream (enhancement) #184

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've written a sort.py to go in hotwire/builtins/  It takes the name of
properties to sort by, and an optional -r flag.  (Also needs a line in
hotwire/builtin.py )

Examples include

proc -a | sort owner_name cmd

ls | sort mimetype | head

Original issue reported on code.google.com by dmi...@gmail.com on 18 Apr 2008 at 5:36

Attachments:

GoogleCodeExporter commented 9 years ago
Cool, thanks.  I did a few small tweaks on this patch:

* SortKey inherits from object and calls superclass constructor, I try to be
consistent on this
* can just say list(context.args) rather than doing list.append in loop
* added a test
* added it to builtin.py to be loaded

Committing to https://hotwire-shell.googlecode.com/svn/trunk ...
    M   hotwire/builtin.py
    A   hotwire/builtins/sort.py
    M   hotwire/test_command.py
Committed r1240

Thanks!

Original comment by cgwalt...@gmail.com on 4 May 2008 at 3:12

GoogleCodeExporter commented 9 years ago
Cool.  Just wondering, did you notice the tail builtin I appended to issue 156 
?  At
the time I was unsure about a couple of things (noted there) but as I've learnt 
more
python I think it is reasonable.  Should probably say that there really ...

Original comment by dmi...@gmail.com on 7 May 2008 at 4:03