Class: I18nContextGenerator::CLI
- Inherits:
-
Thor
- Object
- Thor
- I18nContextGenerator::CLI
- Defined in:
- lib/i18n_context_generator/cli.rb
Overview
Thor-based CLI entry point for the i18n-context-generator command.
Class Method Summary collapse
Instance Method Summary collapse
- #apply ⇒ Object
- #check ⇒ Object
- #extract ⇒ Object
- #init ⇒ Object
- #plan ⇒ Object
- #preview_diff ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
37 38 39 |
# File 'lib/i18n_context_generator/cli.rb', line 37 def self.exit_on_failure? true end |
.extraction_options ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/i18n_context_generator/cli.rb', line 27 def self. Config::Schema.cli_definitions.each do |definition| option definition.cli_name, **definition. end option :translations, type: :string, hide: true, desc: 'Deprecated: comma-separated translation files' option :keys, type: :string, hide: true, desc: 'Deprecated: comma-separated key filters' end |
Instance Method Details
#apply ⇒ Object
87 88 89 |
# File 'lib/i18n_context_generator/cli.rb', line 87 def apply run_workflow('apply') end |
#check ⇒ Object
68 69 70 |
# File 'lib/i18n_context_generator/cli.rb', line 68 def check run_workflow('check') end |
#extract ⇒ Object
62 63 64 |
# File 'lib/i18n_context_generator/cli.rb', line 62 def extract run_workflow(nil) end |
#init ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/i18n_context_generator/cli.rb', line 94 def init config_path = '.i18n-context-generator.yml' if File.exist?(config_path) && ![:force] say_error 'Config file already exists. Use --force to overwrite.' exit 1 end File.write(config_path, sample_config) say "Created #{config_path}" end |
#plan ⇒ Object
74 75 76 |
# File 'lib/i18n_context_generator/cli.rb', line 74 def plan run_workflow('plan') end |
#preview_diff ⇒ Object
81 82 83 |
# File 'lib/i18n_context_generator/cli.rb', line 81 def preview_diff run_workflow('preview_diff') end |
#version ⇒ Object
107 108 109 |
# File 'lib/i18n_context_generator/cli.rb', line 107 def version say "i18n-context-generator #{VERSION}" end |