class Steamd::CliOptions

Options that the CLI can take

Public Class Methods

new(opts = {}) click to toggle source

Create a CliOptions object

@example Using CliOptions

opts = CliOptions.new(ouput: './')

@param opts [Hash] options hash @option opts [String] :output the output directory @option opts [String] :input the output directory

# File lib/steamd/cli_options.rb, line 13
def initialize(opts = {})
  @options = opts
  @output  = opts[:output]
  @input   = opts[:input]
  self
end

Public Instance Methods

input() click to toggle source

Returns the absolute path of the input directory specified by the cli.

Throws an exception if the input is not a directory

@example Getting the input path

opts = CliOptions.new(input: '/some/dir')
opts.input # => '/some/dir'
# File lib/steamd/cli_options.rb, line 28
def input
  o = if @input.nil?
        Steamd.language_dir
      else
        @input
      end

  raise 'input must be a directory' unless File.directory?(o)
  File.expand_path(o)
end
output() click to toggle source

Returns the absolute path of the output directory specified by the cli.

Throws an exception if the output is not a directory

@example Getting the output path

opts = CliOptions.new(output: '/some/dir')
opts.output # => '/some/dir'
# File lib/steamd/cli_options.rb, line 47
def output
  o = if @output.nil?
        './lib/steamd'
      else
        @output
      end

  raise 'output must be a directory' unless File.directory?(o)
  File.expand_path(o)
end