Sha256: 1fabcb10e2701b583e521eeaba5e8b767e09fc9b121048b50879d32b0fda6aad
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
require 'optparse' require 'yaml' require 'ostruct' module Mir class Options USAGE_BANNER = "Usage: mir [options] [settings_file_path] [target]" def self.parse(args) options = OpenStruct.new options.debug = false options.verbose = false options.settings_file = nil options.log_destination = STDOUT options.flush = false options.copy = false options.settings_path = nil opts_parser = OptionParser.new do |opts| opts.banner = USAGE_BANNER opts.separator "" opts.separator "Specific options:" opts.on("--flush", "Flush the file index") do options.flush = true end opts.on("-c", "--copy", "Copy the remote files to target") do options.copy = true end opts.on("--settings", String, "The YAML settings file") do |path| options.settings_path = path end opts.on("-l", "--log-path LOG_FILE", String, "Location for storing execution logs") do |log_file| options.log_destination = log_file end opts.on("-v", "--verbose", "Run verbosely") do |v| options.verbose = true end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end opts.on_tail("--version", "Show version") do puts Mir.version exit end end opts_parser.parse!(args) options end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mir-0.1.2 | lib/mir/options.rb |