[pca] yet another sunsolve today's (31.5.2010) hang up?

Martin Paul martin at par.univie.ac.at
Wed Jun 2 12:26:46 CEST 2010


dpecka wrote:
> i think, that for -l|--list operation would be very useful a possibility
> of sorting by --format %{keys} ..

Ok, I've put it on the ToDo list. As I just noticed how ugly the code 
around --format (and creating the output in general) is, I will probably 
do the necessary changes at the same time (when I find the time).

> it couldn't be so hard to do it as far as you'll do it at the end of
> creating *patch_list() process functions as sort_patch_list() or so ..

Yes, something like that should work.

> the usage could be as follows:
> 
> --asort %{key} :ascending sort by key
> --dsort %{key} :descending sort by key
> --esort "{$sort_expression},%{key}" :perl sort() expressions including
> brackets {} and coma separated  %{key}

That should be about as versatile as possible, agreed.

> example:
> 
> -Hl total  --{a,d}sort "%a" --format="%p-%c %y"
>
 > pca -Hl total --format="%a %p-%c %y" | perl -e '
 > push @foo, $_ while(<>);
 > do { s/^\s*\d+\s+//; print; } foreach sort {$a <=> $b} @foo;'

I always like real-world examples, and requesting a list of all patches 
sorted by age of course makes sense. Personally I'd use a command like 
that to achieve the same result:

   pca -Hl total --format="%a %p-%c %y" | sort -n | cut -c5-

OTOH this is a good example to explain my reluctancy to add every new 
idea to pca. In the good old tradition of Unix, there are small 
utilities which usually do one thing, but that very good. All these are 
supposed to work hand in hand to achieve the wanted result. There's a 
reason why tools like sort/cut/awk/ed etc. exist for such a long time. 
But of course it also makes sense have basic functionality in a tool 
itself, as it has probably more information that it displays (and can 
feed to sort). After all, "ls" has some sorting options, too :)

This is just to explain why I sometimes hesitate (or even refuse) to add 
some new feature to pca immediately.

Martin.



More information about the pca mailing list