Class: Localeapp::CLI::Add
Instance Method Summary collapse
Methods inherited from Command
#initialize, #initialize_config, #load_config_file, #set_command_line_arguments
Constructor Details
This class inherits a constructor from Localeapp::CLI::Command
Instance Method Details
#execute(key, *translations) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/localeapp/cli/add.rb', line 4 def execute(key, *translations) @output.puts "Localeapp Add" @output.puts "" translations.each do |translation| if translation =~ /([\w\-]+):(.*)/m locale, description = $1, $2 Localeapp.missing_translations.add(locale, key, description) else @output.puts "Ignoring bad translation #{translation}" @output.puts "format should be <locale>:<translation content>" end end @output.puts "Sending key: #{key}" Localeapp.sender.post_missing_translations @output.puts "Success!" end |