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: 
ok, so I made this library for creating console applications in ruby. Actually it was some while ago, but only just decided to release it. It does support auto-completion if used with HighLine and Readline.

When I wrote it there wasn't any documentation nor tests/specs, but now I made some. Still not much but for beginning should be ok.

So gem [cli-console](https://rubygems.org/gems/cli-console) and
code is at GitHub, here's [usage example](https://github.com/davispuh/CLI-Console/blob/master/examples/shell.rb)
```
class MyAPI
  def self.__is__(text)
    @__is__ = text
  end

  def self.method_added(method)
    @__help__ ||= {}
    @__help__[method.to_s] = @__is__
    @__is__ = nil
  end

  def self.help(of)
    @__help__[of]
  end

  __is__ "open file <file>"
  def open(file)
    #...
  end

  __is__ "do X"
  def do(*params)
    #...
  end

  __is__ "calls help, use help <command>"
  def help(*args, &block)
    self.class.help(*args, &block)
  end
end

MyAPI.new(...).pry

```

Or you could use pry commands, but that defeats the
turing-completeness. Help might be implemented using commands, as I'm
not sure how well my approach works out. Those methods need to be
coded defensive. I can't remember how to use class variables :-/