module I18n::Tasks::Command::Commands::Data
Public Instance Methods
Source
# File lib/i18n/tasks/command/commands/data.rb, line 29 def check_normalized(opt) non_normalized = i18n.non_normalized_paths locales: opt[:locales] terminal_report.check_normalized_results(non_normalized) :exit1 unless non_normalized.empty? end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 52 def cp(opt = {}) fail CommandError, 'requires FROM_KEY_PATTERN and TO_KEY_PATTERN' if opt[:arguments].size < 2 from_pattern = opt[:arguments].shift to_pattern = opt[:arguments].shift forest = i18n.data_forest results = forest.mv_key!(compile_key_pattern(from_pattern), to_pattern, root: false, retain: true) i18n.data.write forest terminal_report.cp_results results end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 82 def data(opt = {}) print_forest i18n.data_forest(opt[:locales]), opt end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 91 def data_merge(opt = {}) forest = merge_forests_stdin_and_pos!(opt) merged = i18n.data.merge!(forest) print_forest merged, opt end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 113 def data_remove(opt = {}) removed = i18n.data.remove_by_key!(forest_pos_or_stdin!(opt)) log_stderr 'Removed:' print_forest removed, opt end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 102 def data_write(opt = {}) forest = forest_pos_or_stdin!(opt) i18n.data.write forest print_forest forest, opt end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 38 def mv(opt = {}) fail CommandError, 'requires FROM_KEY_PATTERN and TO_KEY_PATTERN' if opt[:arguments].size < 2 from_pattern = opt[:arguments].shift to_pattern = opt[:arguments].shift forest = i18n.data_forest results = forest.mv_key!(compile_key_pattern(from_pattern), to_pattern, root: false) i18n.data.write forest terminal_report.mv_results results end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 19 def normalize(opt = {}) i18n.normalize_store! locales: opt[:locales], force_pattern_router: opt[:pattern_router] end
Source
# File lib/i18n/tasks/command/commands/data.rb, line 66 def rm(opt = {}) fail CommandError, 'requires KEY_PATTERN' if opt[:arguments].empty? forest = i18n.data_forest results = opt[:arguments].each_with_object({}) do |key_pattern, h| h.merge! forest.mv_key!(compile_key_pattern(key_pattern), '', root: false) end i18n.data.write forest terminal_report.mv_results results end