[darcs-devel] [issue1548] darcs query contents doesn't enforce mandatory argument

Trent W. Buck bugs at darcs.net
Sat Aug 29 07:07:30 UTC 2009


Trent W. Buck <trentbuck at gmail.com> added the comment:

> Usage: darcs show contents [OPTION]... [FILE]...

The problem is that these are meaningful:

    darcs show contents f
    darcs show contents f1 f2 ... fn

but this is not:

    darcs show contents

I am not sure if "one-or-more" can be expressed by the current
command_extra_args setup.  Perhaps the bodge of using -1 to mean "zero
or more" could be extended such that -2 means "one or more".

We could work around it by simply removing the ability to "cat"
multiple files at once, but it means that the (uncommon?) case of

    darcs show contents f1 f2 ... fn

will be O(n) instead of O(1), which could be very slow if you are
fetching a very old repository state.

All this aside, I suppose the command_extra_args = -1 could be left
as-is, and simply case have

    show_contents_cmd opts [] = <throw an error here>

I'll try that presently.

----------
nosy: +twb

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1548>
__________________________________


More information about the darcs-devel mailing list