Sha256: b3277e27856762d09f842d034092572ddd356ab7f46ed887e11c75cace30e07c

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 Bytes

Contents

# 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]

        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 == :exit_1 }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
i18n-tasks-0.9.33 lib/i18n/tasks/command/commands/health.rb
i18n-tasks-0.9.32 lib/i18n/tasks/command/commands/health.rb
i18n-tasks-0.9.31 lib/i18n/tasks/command/commands/health.rb
i18n-tasks-0.9.30 lib/i18n/tasks/command/commands/health.rb