Sha256: ee3f3e72fc28ee5f4f9554fa213f10f8adeba7e7e9064de8d6f35eb43147807c

Contents?: true

Size: 908 Bytes

Versions: 4

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true
module I18n::Tasks
  module Command
    module Commands
      module Meta
        include Command::Collection

        cmd :config,
            pos:  '[section ...]',
            desc: t('i18n_tasks.cmd.desc.config')

        def config(opts = {})
          cfg = i18n.config_for_inspect
          cfg = cfg.slice(*opts[:arguments]) if opts[:arguments].present?
          cfg = cfg.to_yaml
          cfg.sub! /\A---\n/, ''
          cfg.gsub! /^([^\s-].+?:)/, Term::ANSIColor.cyan(Term::ANSIColor.bold('\1'))
          puts cfg
        end

        cmd :gem_path, desc: t('i18n_tasks.cmd.desc.gem_path')

        def gem_path
          puts I18n::Tasks.gem_path
        end

        cmd :irb, desc: t('i18n_tasks.cmd.desc.irb')

        def irb
          require 'i18n/tasks/console_context'
          ::I18n::Tasks::ConsoleContext.start
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i18n-tasks-0.9.6 lib/i18n/tasks/command/commands/meta.rb
i18n-tasks-0.9.5 lib/i18n/tasks/command/commands/meta.rb
i18n-tasks-0.9.4 lib/i18n/tasks/command/commands/meta.rb
i18n-tasks-0.9.3 lib/i18n/tasks/command/commands/meta.rb