Question: I want make interactive application where user launches it and can do various task by typing commands (some kind of shell)

example:  

```
./myapp.rb  
App says Hi  
Commands:   
  help - display help about command
  open - open task
  do - do action
Start>help open
  open <TaskName>
  opens specified task
Start>open Something  
Something>do SomeAction
  Success!
Something> (blinking cursor here)

```

I searched but couldn't find any ruby gems that I could use specially for console interaction, so I'm about to my make my own...

I looked at [Thor](https://www.ruby-toolbox.com/projects/thor), but that's not exactly as I want, maybe I could use it, but not sure...

it could look something like:

```
class Tasks
  attr_reader :opened_task

  desc "open <TaskName>", "opens specified task"
  def open(params)
  end

  desc "do <ActionName>", "do specified action"
  def do(params)
  end
end

tasks = Tasks.new
# theoretical Console class
console = Console.new
console.addCommand("open",tasks.method(:open),"open task")
console.addCommand("do",tasks.method(:do),"do action")
console.start("%s>",[*tasks.opened_task])

```

so my question is, what gems I could use to make such console class? maybe someone have already made something similar?
I plan using [HighLine](https://www.ruby-toolbox.com/gems/highline) for input/output, but any other suggestion what could I use?

Answer: 
You could also try [ripl](https://github.com/cldwalker/ripl). (from the documentation): 
Creating and starting a custom shell is as simple as:

```
require 'ripl'
# Define plugins, load files, etc...
Ripl.start

```

There is a comprehensive list of plugins for ripl as well as list of console applications using ripl on the projects website.
Take a look at `cliqr` ruby gem. It looks like exactly what you need. Here is the github link with a descriptive readme: <https://github.com/anshulverma/cliqr>

It can execute the commands directly or within a inbuilt shell.

Here is a test case from its git repo:

```
    it 'can execute a sub action from shell' do
      cli = Cliqr.interface do
        name 'my-command'
        handler do
          puts 'base command executed'
        end

        action :foo do
          handler do
            puts 'foo executed'
          end

          action :bar do
            handler do
              puts 'bar executed'
            end
          end
        end
      end

      with_input(['', 'my-command', 'foo', 'foo bar', 'foo bar help']) do
        result = cli.execute %w(my-command shell), output: :buffer
        expect(result[:stdout]).to eq <<-EOS
Starting shell for command "my-command"
my-command > .
base command executed
my-command > my-command.
base command executed
my-command > foo.
foo executed
my-command > foo bar.
bar executed
my-command > foo bar help.
my-command foo bar

USAGE:
    my-command foo bar [actions] [options] [arguments]

Available options:

    --help, -h  :  Get helpful information for action "my-command foo bar" along with its usage information.

Available actions:
[ Type "my-command foo bar help [action-name]" to get more information about that action ]

    help -- The help action for command "my-command foo bar" which provides details and usage information on how to use the command.
my-command > exit.
shell exited with code 0
        EOS
      end
    end

```