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

Ben Franksen benjamin.franksen at bessy.de
Mon Oct 5 15:39:02 UTC 2009

Dan Pascu wrote:
> 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.

You have convinced me. I hadn't thought about shell aliases.

So we have to make certain that whenever two options are allowed with some
command, then either they are mutually exclusive (and the one given later
will win) or else they should be orthogonal. Otherwise it will be very hard
to predict outcome of darcs commands.


More information about the darcs-users mailing list