[darcs-devel] [issue1431] darcs changes: --interactive=auto

Trent Buck bugs at darcs.net
Fri Apr 10 06:54:25 UTC 2009


New submission from Trent Buck <trentbuck at gmail.com>:

When I put "changes interactive" in ~/.darcs/defaults, it usually does
the right thing -- for example, I can then just run "darcs foo.c" to
get an interactive prompt about foo.c.

But when stdio is a pipeline, I do not want it to be interactive by
default.  Specifically, in these cases:

    darcs changes GNUmakefile | less

    darcs changes GNUmakefile -v | grep hoogle

In both cases, the output is VERY confusing.  In the first case, it
hangs after printing the following lines.  The prompt isn't printed,
because less is line buffered.  Pressing keys, which I expect less to
"see" are instead captured by Darcs.

    Mon Apr  6 19:29:52 EST 2009  Trent W. Buck <trentbuck at gmail.com>
      * Remove autoconf references to patch_theory.pdf, which is subsumed by haddock.

In the second case, NOTHING is printed, because neither the first
patch nor the prompt match the grep pattern.  Grep waits forever for
Darcs to print something, and Darcs waits forever for my input.  It
looks to me, the end user, like grep is just searching lots and lots
of text and not finding anything.  (BTW, this is similar to the case
where one runs grep but forgets to give it a file to grep over.)

Furthermore, there is currently no way to DISABLE interactive,
i.e. there is no --no-interactive or --dont-interactive option.

I think the best solution to this is to allow --interactive to take
arguments similar to the GNU ls --color switch.  That is,

    --interactive=yes   # always interactive, the current --interactive behaviour
    --interactive=no    # never interactive, the current default behaviour
    --interactive=auto  # interactive if and only if stdin and stdout
                          are BOTH connected to a terminal.  In bash
                          that would be "test -t 0 -t 1".

----------
messages: 7664
nosy: dmitry.kurochkin, kowey, simon, thorkilnaur, twb
status: unread
title: darcs changes: --interactive=auto

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


More information about the darcs-devel mailing list