darcs

Issue 1431 darcs changes: --interactive=auto

Title darcs changes: --interactive=auto
Priority wishlist Status given-up
Milestone Resolved in
Superseder Replace --no-foo switch with --foo=no
View: 1457
Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, twb
Assigned To
Topics UI

Created on 2009-04-10.06:54:25 by twb, last changed 2017-07-30.23:23:47 by gh.

Messages
msg7664 (view) Author: twb Date: 2009-04-10.06:54:22
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@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".
msg7667 (view) Author: kowey Date: 2009-04-10.13:39:14
Three possible responses:

1) Decide that changes -i in defaults is too much of a corner case to deal with.
 Discourage users from putting --interactive in their defaults.  Discourage, not
forbid :-)

2) Add --no-interactive as an option.  Small job, but adds to flag proliferation.

3) Add this new style of switches to darcs, probably deprecating the old ones in
the process.  So right now, we have --foo, --no-foo and --dont-foo as switches.
 They new --foo={yes,no,etc} option is interesting, but we shouldn't just add it
piecemeal.  If we were going to do this, it would probably make sense to do this
for all switches, probably hiding the --no/--dont switches in the process.  This
is potentially a big top-down (think very hard and design) job, not the kind of
thing we want to do in the usual organic bottom-up fashion (which works for most
things).  See also http://bugs.darcs.net/issue1157
msg8419 (view) Author: kowey Date: 2009-08-23.18:17:16
I've moved my #3 from msg7667 to issue1557 and I suggest we think about that
first before thinking about this.
msg8950 (view) Author: twb Date: 2009-10-11.07:18:29
On Fri, Apr 10, 2009 at 06:54:22AM +0000, Trent W. Buck wrote:
> When stdio is a pipeline, I do not want [darcs changes] to be
> interactive.  Specifically, in these cases:
>
>     darcs changes GNUmakefile | less
>     darcs changes GNUmakefile -v | grep hoogle

This is actually worse than I thought.  If interactive is the default,

    cabal install

silently hangs, because it internally calls "darcs changes --count",
which with an implied --interactive causes it to hang forever.  Argh!
History
Date User Action Args
2009-04-10 06:54:25twbcreate
2009-04-10 13:39:20koweysetpriority: wishlist
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
topic: + UI
status: unread -> unknown
messages: + msg7667
2009-08-23 18:17:18koweysetstatus: unknown -> deferred
nosy: kowey, simon, twb, thorkilnaur, dmitry.kurochkin
superseder: + option lists overhaul: --foo={yes,no} instead of --{no-}foo
messages: + msg8419
2009-08-25 17:43:23adminsetnosy: + darcs-devel, - simon
2009-08-27 14:31:02adminsetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin
2009-08-27 17:26:07koweysetstatus: deferred -> waiting-for
nosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin
2009-08-27 17:26:28koweysetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin
superseder: + Replace --no-foo switch with --foo=no, - option lists overhaul: --foo={yes,no} instead of --{no-}foo
2009-10-11 07:18:32twbsetnosy: kowey, darcs-devel, twb, thorkilnaur, dmitry.kurochkin
messages: + msg8950
2017-07-30 23:23:47ghsetstatus: waiting-for -> given-up