Sha256: d9e0a4d289b33bd8a92c94d456d32556e90bb52a968234b2115de0e1a2e4b5db
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
# -*- encoding : utf-8 -*- require File.expand_path('../options_factory', __FILE__) class Phrase::Tool::Options def initialize(args, command="") @command = command # specify all possible arguments here @data = { default: { version: false, help: false }, init: { secret: "", default_locale: "en", domain: "phrase", format: nil, locale_filename: nil, locale_directory: nil, target_directory: nil }, push: { tags: [], recursive: false, locale: nil, format: nil }, pull: { format: nil, target: nil } } options.parse!(args) end def get(name) return @data.fetch(command_name).fetch(name.to_sym) rescue => e $stderr.puts "Invalid or missing option \"#{name}\" for command \"#{command_name}\"" end private def options OptionsFactory.options_for(command_name, @data) end def command_name @command_name ||= (@command.present? and @data.has_key?(@command.to_sym)) ? @command.to_sym : :default end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phrase-0.4.4 | lib/phrase/tool/options.rb |
phrase-0.4.3 | lib/phrase/tool/options.rb |
phrase-0.4.2 | lib/phrase/tool/options.rb |