[pacman-dev] [PATCH] makepkg: use tput for terminal-safe colored and bold text
Cedric Staniewski
cedric at gmx.ca
Fri Oct 23 06:59:04 EDT 2009
Dan McGee wrote:
> On Thu, Oct 22, 2009 at 8:50 PM, Allan McRae <allan at archlinux.org> wrote:
>> Dan McGee wrote:
>>> On Thu, Oct 22, 2009 at 7:41 PM, Allan McRae <allan at archlinux.org> wrote:
>>>
>>>> Cedric Staniewski wrote:
>>>>
>>>>> Suggested-by: Dan McGee <dan at archlinux.org>
>>>>> Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
>>>>> ---
>>>>>
>>>>> I do not know if this patch is usefull at all, because I do not notice
>>>>> any
>>>>> change. Just grabbed this from Dan's TODO list and wanted to play a bit
>>>>> with tput.
>>>>>
>>>>>
>>>> It looks fine to me...
>>>> I just have no idea on the advantage we are achieving with this change
>>>> apart
>>>> from the apparent terminal safeness. Was the old version not safe?
>>>>
>>>> Dan: comments?
>>>>
>>> First comment- that TODO list is still huge, wow. :)
>>>
>>> Anyway, this seems pretty reasonable to me, but not sure it is worth
>>> it. At the least, we should capture these sequences once on script
>>> startup, and then use the global variable in each function. And does
>>> $(tput offbold) make more sense for the reset?
>>>
>> There does not appear to be such a thing as "tput offbold".
>
> You are quite right, I just read the manpage wrong:
> bold=`tput smso` offbold=`@TPUT@ rmso`
> Set the shell variables bold, to begin stand-out mode
> sequence, and offbold, to end standout mode sequence, for the
> current
> terminal. This might be followed by a prompt: echo
> "${bold}Please type in your name: ${offbold}\c"
>
Just for the record, the capability names can be found at the terminfo manpage. The tput manpage was not that helpful in this context.
By the way, the example you quoted does not work as I expected for me; it does not bold the text, but changes the background color to grey.
More information about the pacman-dev
mailing list