Color sequences in ri on Windows

After installing some gems, the system recommended that I refresh ri
and rdoc. I may have actually updated the ri and rdoc programs too;
unfortunately I don't remember which commands I used. After that,
whenever I use ri the output is full of ANSI color sequences; I'm on
Windows (using 1.9.1p429 from RubyInstaller) using the Windows
console, so they don't display as color. I thought maybe installing
win32console would fix it, but it didn't.

So: What commands might I have typed that put color sequences into ri?
And how do I either remove the color sequences, or make them display
as color?

So: What commands might I have typed that put color sequences into ri?
And how do I either remove the color sequences, or make them display
as color?

GitHub - adoxa/ansicon: Process ANSI escape sequences for Windows console programs. might help too

···

--
Posted via http://www.ruby-forum.com/\.

Eric Christopherson wrote in post #944561:

After installing some gems, the system recommended that I refresh ri
and rdoc. I may have actually updated the ri and rdoc programs too;
unfortunately I don't remember which commands I used. After that,
whenever I use ri the output is full of ANSI color sequences; I'm on
Windows (using 1.9.1p429 from RubyInstaller) using the Windows
console, so they don't display as color. I thought maybe installing
win32console would fix it, but it didn't.

So: What commands might I have typed that put color sequences into ri?
And how do I either remove the color sequences, or make them display
as color?

The easiest way I found on Windows to solve this is to just set the RI
environment variable to use the "bs" formatter instead of the default
"ansi".

You can test this in a CMD session using...

set RI=--format bs

...then you can run various "ri" commands to see that it's working.

You can also set this permanently in your Advanced system settings via:
- Windows-key + Pause/Break (this is a nice control panel System
shortcut key)
- Click on "Advanced system settings"
- Click on "Environment Variables..." button
- In the "System variables" section, click "New..." button
- In "Variable name:" text field, add "RI"
- In "Variable value:" text field, add "--format bs"
- Click OK on the various dialogs and close the System control panel

Now you can launch a new CMD session and your "ri" commands will be
plain text.

Enjoy!

···

--
Posted via http://www.ruby-forum.com/\.

Thanks!

It's been so long since I ran ri under Windows that I'm not sure I even
have this problem anymore; but when I go back to work I will try it out.

···

On Sun, Oct 13, 2013 at 3:55 PM, Steve Smythe <lists@ruby-forum.com> wrote:

Eric Christopherson wrote in post #944561:
> After installing some gems, the system recommended that I refresh ri
> and rdoc. I may have actually updated the ri and rdoc programs too;
> unfortunately I don't remember which commands I used. After that,
> whenever I use ri the output is full of ANSI color sequences; I'm on
> Windows (using 1.9.1p429 from RubyInstaller) using the Windows
> console, so they don't display as color. I thought maybe installing
> win32console would fix it, but it didn't.
>
> So: What commands might I have typed that put color sequences into ri?
> And how do I either remove the color sequences, or make them display
> as color?

The easiest way I found on Windows to solve this is to just set the RI
environment variable to use the "bs" formatter instead of the default
"ansi".

You can test this in a CMD session using...

set RI=--format bs

...then you can run various "ri" commands to see that it's working.

You can also set this permanently in your Advanced system settings via:
- Windows-key + Pause/Break (this is a nice control panel System
shortcut key)
- Click on "Advanced system settings"
- Click on "Environment Variables..." button
- In the "System variables" section, click "New..." button
- In "Variable name:" text field, add "RI"
- In "Variable value:" text field, add "--format bs"
- Click OK on the various dialogs and close the System control panel

Now you can launch a new CMD session and your "ri" commands will be
plain text.

Enjoy!