-
Notifications
You must be signed in to change notification settings - Fork 264
/
health.rb
30 lines (26 loc) · 817 Bytes
/
health.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
# frozen_string_literal: true
module I18n::Tasks
module Command
module Commands
module Health
include Command::Collection
cmd :health,
pos: '[locale ...]',
desc: t('i18n_tasks.cmd.desc.health'),
args: %i[locales out_format config]
def health(opt = {})
forest = i18n.data_forest(opt[:locales])
stats = i18n.forest_stats(forest)
fail CommandError, t('i18n_tasks.health.no_keys_detected') if stats[:key_count].zero?
terminal_report.forest_stats forest, stats
[
missing(**opt),
unused(**opt),
check_consistent_interpolations(**opt),
check_normalized(**opt)
].detect { |result| result == :exit1 }
end
end
end
end
end