Sha256: de1e5d1bb0dd228a82625a503238a80cf72e403ed3e7c2c54a024e41c9498178

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

module I18n::Tasks
  module Command
    module Commands
      module Data
        include Command::Collection

        cmd_opt :pattern_router, {
            short: :p,
            long:  :pattern_router,
            desc: t('i18n_tasks.cmd.args.desc.pattern_router'),
            conf:  {argument: false, optional: true}
        }

        cmd :normalize,
            args: '[locale ...]',
            desc: t('i18n_tasks.cmd.desc.normalize'),
            opt:  cmd_opts(:locales, :pattern_router)

        def normalize(opt = {})
          i18n.normalize_store! opt[:locales], opt[:pattern_router]
        end

        cmd :data,
            args: '[locale ...]',
            desc: t('i18n_tasks.cmd.desc.data'),
            opt:  cmd_opts(:locales, :out_format)

        def data(opt = {})
          print_forest i18n.data_forest(opt[:locales]), opt
        end

        cmd :data_merge,
            args: '[tree ...]',
            desc: t('i18n_tasks.cmd.desc.data_merge'),
            opt:  cmd_opts(:data_format, :nostdin)

        def data_merge(opt = {})
          forest = opt_forests_merged_stdin_args!(opt)
          merged = i18n.data.merge!(forest)
          print_forest merged, opt
        end

        cmd :data_write,
            args: '[tree]',
            desc: t('i18n_tasks.cmd.desc.data_write'),
            opt:  cmd_opts(:data_format, :nostdin)

        def data_write(opt = {})
          forest = opt_forest_arg_or_stdin!(opt)
          i18n.data.write forest
          print_forest forest, opt
        end

        cmd :data_remove,
            args: '[tree]',
            desc: t('i18n_tasks.cmd.desc.data_remove'),
            opt:  cmd_opts(:data_format, :nostdin)

        def data_remove(opt = {})
          removed = i18n.data.remove_by_key!(opt_forest_arg_or_stdin!(opt))
          log_stderr 'Removed:'
          print_forest removed, opt
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
i18n-tasks-0.7.13 lib/i18n/tasks/command/commands/data.rb
i18n-tasks-0.7.12 lib/i18n/tasks/command/commands/data.rb
i18n-tasks-0.7.11 lib/i18n/tasks/command/commands/data.rb
i18n-tasks-0.7.10 lib/i18n/tasks/command/commands/data.rb
i18n-tasks-0.7.9 lib/i18n/tasks/command/commands/data.rb
i18n-tasks-0.7.8 lib/i18n/tasks/command/commands/data.rb