-
Notifications
You must be signed in to change notification settings - Fork 265
/
meta.rb
37 lines (30 loc) · 887 Bytes
/
meta.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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-].+?:)/, Rainbow('\1').cyan.bright)
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