ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RP] Patch for frames et al...


From: Ryan Yeske
Subject: Re: [RP] Patch for frames et al...
Date: Fri Nov 2 19:58:02 2001
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Mike Meyer <address@hidden> writes:

> Ryan Yeske <address@hidden> types:
> > If `ratpoison --command=defbgcolor' outputs anything other/more than
> > just the name of the color then this script would not work.
> 
> So fix the script. Just change the first line to:
> oldbgcolor=`ratpoison -command=defbgcolor | sed 's/.*= //'`

What if the output of the command has an `=' in it?  You're sed regexp
will eat too much.  I don't want to play regexp games to get simple
things working right.
 
> One of the goals when I rewrote all the commands to output values was
> making the commands not need to change their behavior depending on
> whether they are interactive or not. To do that means the output needs
> to be verbose enough for humans reading it interactively, but regular
> enough that scripts can pull the value out.

I can sympathize with the goal of keeping the code simple, but
outputting the same text for interactive and non-interactive calls
compromises both.
 
> How about a third alternative: the commands output the command that
> would set the variable to it's current value? That would make your
> script even easier, is understandable by humans, and it's still easy
> to pull out just the value if you wanted that for some reason.

Why craft a one size fits all solution?  Clearly, the right thing for
non-interactive use is not the same as the right thing for interactive
use.  And since we have the `interactive' argument to all the cmd's
its easy to tailor the output to the calling method.

Ryan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]