Class: Rhino::CLI
- Inherits:
-
Object
- Object
- Rhino::CLI
- Defined in:
- lib/rhino/cli.rb
Overview
A wrapper for command line interaction that encompasses option parsing, version, help, and execution.
Usage:
cli = Rhino::CLI.new
cli.parse
Constant Summary collapse
- BANNER =
"usage: rhino [options] [./config.ru]".freeze
Instance Method Summary collapse
Instance Method Details
#parse(items = ARGV) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rhino/cli.rb', line 13 def parse(items = ARGV) config = Slop.parse(items) do || . = BANNER .on "-h", "--help", "help" do return help() end .on "-v", "--version", "version" do return version end .string "-b", "--bind", "bind (default: 0.0.0.0)", default: "0.0.0.0" .integer "-p", "--port", "port (default: 5000)", default: 5000 .integer "--backlog", "backlog (default: 64)", default: 64 .boolean "--reuseaddr", "reuseaddr (default: true)", default: true end run(config) end |