title: Terminal friendly output for IEx.Helper.h while outputting to something not TTY
body: <p>Following this <a href="https://elixirforum.com/t/command-line-shortcut-to-elixirs-help/4381/9" rel="nofollow noreferrer">Elixir Forum</a> post, I created a shell script to view Elixir documentation by running <code>IEx.Helpers.h</code>:</p>
  
  <pre><code>elixir -e "require IEx.Helpers; IEx.Helpers.h($1)"
  </code></pre>
  
  <p>(where <code>$1</code> is the command line argument to the script). (For example, the command</p>
  
  <pre><code>elixir -e "require IEx.Helpers; IEx.Helpers.h(List)"
  </code></pre>
  
  <p>gives documentation for the module <code>List</code>.)</p>
  
  <p>This is super nice. No need to run <code>iex</code> to view documentation anymore. Default formatting for terminal works nice and beautifully. But if I pipe the output to pager (or more generally, if the output is not a TTY device), the formatting changes - plain ASCII output without ANSI colors.</p>
  
  <p>Question: how do I configure or direct <code>IEx.Helper.h</code> to provide identical output in the non-TTY case?</p>
  
  <p>(It looks like there is function <code>IEx.configure</code> that can be used to change the formatting, but I could not see anything about non-TTY output. Another way would be to use some suitable miniscule external program to create a pseudo-TTY, redirecting <code>stdout</code> to that before running the <code>elixir</code> commmand... but I would prefer solving the output problem from Elixir side.)</p>