Sha256: c413691bab4066dfb955da9e8b0cc54a778532d9b4d3b23145779e70b2b64218

Contents?: true

Size: 898 Bytes

Versions: 5

Compression:

Stored size: 898 Bytes

Contents

module Vedeu
  class Configuration
    def self.configure(args = [])
      new(args).configure
    end

    def initialize(args = [])
      @args    = args
      @options = {}
    end

    def configure
      parser = OptionParser.new do |opts|
        opts.banner = "Usage: #{$PROGRAM_NAME} [options]"

        opts.on('-1', '--run-once', 'Run application once.') do
          options[:interactive] = false
        end

        opts.on('-c', '--cooked', 'Run application in cooked mode.') do
          options[:mode] = :cooked
        end

        opts.on('-r', '--raw', 'Run application in raw mode (default).') do
          options[:mode] = :raw
        end

        opts.on('-d', '--debug', 'Run application with debugging on.') do
          options[:debug] = true
        end
      end
      parser.parse!(args)

      options
    end

    private

    attr_accessor :args, :options
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.1.15 lib/vedeu/configuration.rb
vedeu-0.1.14 lib/vedeu/configuration.rb
vedeu-0.1.13 lib/vedeu/configuration.rb
vedeu-0.1.12 lib/vedeu/configuration.rb
vedeu-0.1.10 lib/vedeu/configuration.rb