Class: I18nAdd::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_add/cli.rb

Overview

Command Line Interface for the i18n_add gem.

Provides a clean interface for adding translation entries to YAML files with support for multiple locales, custom file paths, and batch processing.

Defined Under Namespace

Classes: CLIConfig, CLIError, FileMapBuilder, TranslationEntry

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(args = ARGV) ⇒ Object



15
16
17
# File 'lib/i18n_add/cli.rb', line 15

def self.run(args = ARGV)
  new.run(args)
end

Instance Method Details

#run(args) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/i18n_add/cli.rb', line 19

def run(args)
  return show_help if should_show_help?(args)

  begin
    config = parse_arguments(args)
    return show_help if config.help_requested

    validate_configuration(config)
    file_map = build_file_map(config)
    process_translations(file_map)
  rescue CLIError => e
    puts "\e[31m#{e.message}\e[0m"
    raise SystemExit.new(1)
  end
end