Hello Hisham,

Hisham Muhammad wrote:
> On 9/9/07, rubisher <[EMAIL PROTECTED]> wrote:
>> Hello *,
>>
>> First of all congratulation, it's an actual pleasure to read this code: well 
>> structured, documented, ...
>>
>> For the moment I reach line 10 of Compile i.e. "Import OptionParser" and 
>> OptionParser start with:
>>
>> [ "$COLUMNS" ] || export COLUMNS=80
>>
>> is this statement wouldn't be better in Terminal after COLUMNS computation?
> 
> It is usually computed by this time, when scripts are called. This is
> just a fallback for when the output is redirected.
> 
Ok (I think that I well understood) but my question was just a question of file 
location of statement;
I mean it seems to my opinion more logical to put it in Terminal just after 
COLUMNS setup e.g.:
--- Terminal.Orig       2007-09-08 17:18:10.000000000 +0000
+++ Terminal    2007-09-10 11:00:52.000000000 +0000
@@ -4,6 +4,8 @@
  COLUMNS=${SIZE##* }
  ROWS=${SIZE%% *}

+[ "$COLUMNS" ] || export COLUMNS=80
+
  colorGray="\033[1;30m"
  colorBoldBlue="\033[1;34m"
  colorBrown="\033[33m"
=== <> ===

And may be even don't use colors in case outputs are redirected:
--- Terminal.Orig       2007-09-08 17:18:10.000000000 +0000
+++ Terminal    2007-09-10 11:05:33.000000000 +0000
@@ -4,15 +4,34 @@
  COLUMNS=${SIZE##* }
  ROWS=${SIZE%% *}

-colorGray="\033[1;30m"
-colorBoldBlue="\033[1;34m"
-colorBrown="\033[33m"
-colorYellow="\033[1;33m"
-colorBoldGreen="\033[1;32m"
-colorBoldRed="\033[1;31m"
-colorCyan="\033[36m"
-colorBoldCyan="\033[1;36m"
-colorRedWhite="\033[41;37m"
-colorNormal="\033[0m"
-colorBold="${colorYellow}"
-colorOff="${colorNormal}"
+[ "$COLUMNS" ] || export COLUMNS=80
+
+if [ "X$SIZE" = "X" ]
+then
+       # SIZE could be "" when e.g. script run in bg
+       colorGray=""
+       colorBoldBlue=""
+       colorBrown=""
+       colorYellow=""
+       colorBoldGreen=""
+       colorBoldRed=""
+       colorCyan=""
+       colorBoldCyan=""
+       colorRedWhite=""
+       colorNormal=""
+       colorBold=""
+       colorOff=""
+else
+       colorGray="\033[1;30m"
+       colorBoldBlue="\033[1;34m"
+       colorBrown="\033[33m"
+       colorYellow="\033[1;33m"
+       colorBoldGreen="\033[1;32m"
+       colorBoldRed="\033[1;31m"
+       colorCyan="\033[36m"
+       colorBoldCyan="\033[1;36m"
+       colorRedWhite="\033[41;37m"
+       colorNormal="\033[0m"
+       colorBold="${colorYellow}"
+       colorOff="${colorNormal}"
+fi
=== <> ===

I did it in 2 different steps because I would also like to get rid of colors 
with a 'Compile' option or an environement 
variable?

That said, those are just suggestions; up to you to adopt or to reject ;-)

Tx,
        r.

> -- Hisham
> _______________________________________________
> gobolinux-devel mailing list
> [email protected]
> http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel
> 
> 

_______________________________________________
gobolinux-devel mailing list
[email protected]
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to