Sha256: 3e40eeae651ad90bc997e6c9cb73aac23f0982e37b01f39f6f3468ea28f12d9e
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 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, update_translations: false }, pull: { format: nil, target: nil, tag: nil }, tags: { list: true } } 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phrase-0.4.8 | lib/phrase/tool/options.rb |
phrase-0.4.7 | lib/phrase/tool/options.rb |