[darcs-users] darcs patch: add utility functions to Commands.lhs (and 5 more)

Dan Pascu dan at ag-projects.com
Mon Oct 5 12:40:34 UTC 2009


On 3 Oct 2009, at 14:21, Ben Franksen wrote:

> Florent Becker wrote:
>> Reinier Lamers wrote:
>>> These changes offer some useful functionality, but they do suffer  
>>> from
>>> the problems inherent in the current [DarcsFlag] paradigm of  
>>> command line
>>> handling. It seems that when you specify both --quiet and -- 
>>> verbose, you
>>> get the debug output but not the info output.
>>>
>> Yes, but I don't know what would be the right behaviour when faced  
>> with
>> such an inconsistent user.
>
> What I use to do such cases is terminate with an error saying "don't  
> know
> how to be both --quite and --verbose".

The usual solution for this is to consider the command line option  
that came last. If you give an error, it helps nothing, but it can  
hurt a lot. Imagine I have darcs aliases to 'darcs --quiet', but in  
some cases I want to be verbose I can still say darcs --verbose which  
will expand to darcs --quiet --verbose and the later should be  
considered, not an error given, because the only way to fix this is to  
redefine or delete my alias (I'm speaking of shell aliases here).

The reason why it is common practice to use the last option specified,  
is not as much to allow users to get creative in inputting conflicting  
options, but to be able to gracefully handle cases like the one  
described above. No reasonable user will explicitly type darcs --quiet  
--verbose in one single command, but a shell alias expansion may  
produce that.

--
Dan





More information about the darcs-users mailing list