darcs

Issue 1579 --diff-opts can't contain multiple options

Title --diff-opts can't contain multiple options
Priority bug Status given-up
Milestone Resolved in
Superseder Nosy List bsrkaditya, darcs-devel, dixiecko, dmitry.kurochkin, jaredj, kowey, mndrix, twb
Assigned To dixiecko
Topics ProbablyEasy

Created on 2009-08-28.02:18:00 by twb, last changed 2017-07-31.00:52:49 by gh.

Messages
msg8554 (view) Author: twb Date: 2009-08-28.02:17:57
The following doesn't DWIM.  I wanted to set the unified context size
to be huge, i.e. effectively the entire file.

    $ darcs diff --from-tag . --diff-opts '-wpurNd -U 999' tests/check.sh >/dev/null
    diff: invalid option -- ' '
    diff: Try `diff --help' for more information.

But this isn't working because Darcs isn't splitting on whitespace.
That is, it's doing

    diff '-wpurNd -U 200' x y

When what I wanted was

    diff '-wpurNd' '-U' '200' x y
msg8555 (view) Author: twb Date: 2009-08-28.02:40:05
On Fri, Aug 28, 2009 at 02:18:01AM +0000, Trent W. Buck wrote:
>     $ darcs diff --from-tag . --diff-opts '-wpurNd -U 999' tests/check.sh >/dev/null
>     diff: invalid option -- ' '
>     diff: Try `diff --help' for more information.

Workaround is to realize that getopt allows the last short option to
take an argument, without any whitespace:

    --diff-opts -wpurNdU999

Looks bloody confusing, but it works.
msg8558 (view) Author: kowey Date: 2009-08-28.08:42:42
First: could you cook up a regression test? [sigh I feel silly having a test for
such a minor thing, but I guess it's the right thing to do]

Second: I haven't looked at the code, but I think we just need to be calling
words on --diff-opts output and passing the resulting list to exec
msg16593 (view) Author: dixiecko Date: 2013-02-15.13:45:53
There is possible to pass multiple options to diff by using --diff-opts
multiple times:

$ darcs diff --diff-opts '-wpurNd' --diff-opts='-U 999' tests/check.sh

Case study: cabal-install

The cabal-install has two kind of command line parameters:
    --PROG-options=OPTS            give extra options to PROG
    --PROG-option=OPT              give an extra option to PROG (no need
to quote options containing spaces)

It seems the need of usage for --PROG-options=OPTS can be always
expressed with --PROG-option=OPT form, and that --PROG-options=OPTS is
only syntatic sugar / simplification of passing multiple flags.

The current --diff-opts darcs parameter behaves like --PROG-option=OPT.
It appears to me that only its name is confusing and correction of this
issue should not be change of its behavior but clear description of its
usage in the help text. I think parameter name can not be changed since
it is not a backward compatible modification, but better name would be
--diff-opt.

The other approach is to implement the both --diff-opt and --diff-opts,
but I'm not sure whether it is something worth to spend a time: it is
only "nice to have" instead of "need to have"
msg16600 (view) Author: radoslav.dorcik Date: 2013-02-15.15:04:15
Hi All,

regarding this minor issue, I'm not quite sure what is the best
approach.  on the one hand it is necessary to keep backward
compatibility on the other hand without breaking it the clean solution
can not be implemented.

In the text below there are two proposals:
1) update documentation for proper --diff-opts usage for multiple diff parameters
   pros: backward compatible
   cons: users may still be confused by its name 

2) follow the cabal-install apprach and introduce the --diff-opt and --diff-opts
   cons: non-backward compatible, next one additional parameter exposed
   pros: no confusion anymore

Can you help me decide? My preferred solution is 1) since I'm lazy :-)

dixie

Radoslav Dorcik writes:

> Radoslav Dorcik <dixiecko@gmail.com> added the comment:
>
> There is possible to pass multiple options to diff by using --diff-opts
> multiple times:
>
> $ darcs diff --diff-opts '-wpurNd' --diff-opts='-U 999' tests/check.sh
>
> Case study: cabal-install
>
> The cabal-install has two kind of command line parameters:
>     --PROG-options=OPTS            give extra options to PROG
>     --PROG-option=OPT              give an extra option to PROG (no need
> to quote options containing spaces)
>
> It seems the need of usage for --PROG-options=OPTS can be always
> expressed with --PROG-option=OPT form, and that --PROG-options=OPTS is
> only syntatic sugar / simplification of passing multiple flags.
>
> The current --diff-opts darcs parameter behaves like --PROG-option=OPT.
> It appears to me that only its name is confusing and correction of this
> issue should not be change of its behavior but clear description of its
> usage in the help text. I think parameter name can not be changed since
> it is not a backward compatible modification, but better name would be
> --diff-opt.
>
> The other approach is to implement the both --diff-opt and --diff-opts,
> but I'm not sure whether it is something worth to spend a time: it is
> only "nice to have" instead of "need to have"
>
> ----------
> status: needs-diagnosis/design -> needs-implementation
>
> __________________________________
> Darcs bug tracker <bugs@darcs.net>
> <http://bugs.darcs.net/issue1579>
> __________________________________
History
Date User Action Args
2009-08-28 02:18:00twbcreate
2009-08-28 02:40:07twbsetnosy: kowey, darcs-devel, twb, dmitry.kurochkin
messages: + msg8555
2009-08-28 08:42:45koweysetpriority: bug
status: unknown -> needs-reproduction
topic: + ProbablyEasy
messages: + msg8558
nosy: + jaredj
2011-01-05 12:04:36bsrkadityasetnosy: + bsrkaditya
2012-02-23 22:03:10mndrixsetnosy: + mndrix
2013-02-15 09:25:18dixieckosetstatus: needs-reproduction -> needs-diagnosis/design
assignedto: dixiecko
nosy: + dixiecko
2013-02-15 13:45:55dixieckosetstatus: needs-diagnosis/design -> needs-implementation
messages: + msg16593
2013-02-15 15:04:17radoslav.dorciksetmessages: + msg16600
2017-07-31 00:52:49ghsetstatus: needs-implementation -> given-up