class BitsDealer::CLI

Attributes

options[RW]

Public Class Methods

new(args) click to toggle source
# File lib/bits_dealer/cli.rb, line 7
def initialize(args)
  self.options = parse_options(args)
end

Public Instance Methods

run() click to toggle source
# File lib/bits_dealer/cli.rb, line 11
def run
  BitsDealer::REPL.new(options).start
end

Private Instance Methods

parse_options(args) click to toggle source

@private

# File lib/bits_dealer/cli.rb, line 18
def parse_options(args)
  {}.tap do |options|

    OptionParser.new do |opts|
      opts.banner = "Usage: bits_dealer [options]"

      opts.on('--reset', 'Remove your configuration files') do
        options[:reset] = true
      end

      opts.on_tail("-h", "--help", "Show this message") do
        puts opts
        exit
      end
    end.parse!(args)

  end
end