On Thu, Jul 12, 2012 at 10:50 PM, Claudiu Olteanu
<[email protected]> wrote:
> Hello!
>
> My name in Claudiu Olteanu and I want to implement a shell in the Master UI. 
> The problem is that
> I  don't know how to capture the output of the IRB's commands. I tried to 
> create a new ruby class
>
> which runs the commands and save the stdout but it can't call any IRB's 
> methods.
>
> I've never used ruby before, so please give me some tips!
>

I'd say knowing a bit about ruby is probably a prerequisite.

After that, see bin/hirb.rb  Its what is called when you fire up a
shell.  Check it out.  See how you can pass the shell an argument
--format to say how irb should output (currently we only do 'console'
output).  If you look in hirb.rb you will see further down how we
assign console as the @formatter class:

# Presume console format.
# Formatter takes an :output_stream parameter, if you don't want STDOUT.
@formatter = Shell::Formatter::Console.new

See in hbase-server/src/main/ruby/shell/formatter.rb how we have a
base formatter class.  The class has methods that are called to print
a header and tail, then a per row result.  Should be easy enough to
implement html outputs.

St.Ack

Reply via email to