Class: I18nFlow::CLI::LintCommand
- Inherits:
-
CommandBase
- Object
- CommandBase
- I18nFlow::CLI::LintCommand
- Defined in:
- lib/i18n_flow/cli/lint_command.rb,
lib/i18n_flow/cli/lint_command/ascii_renderer.rb,
lib/i18n_flow/cli/lint_command/markdown_renderer.rb
Defined Under Namespace
Classes: AsciiRenderer, MarkdownRenderer
Constant Summary collapse
- DEFAULT_FORMAT =
'ascii'
Instance Method Summary collapse
Methods inherited from CommandBase
#color_enabled?, #exit_with_message, #initialize
Constructor Details
This class inherits a constructor from I18nFlow::CLI::CommandBase
Instance Method Details
#invoke! ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/i18n_flow/cli/lint_command.rb', line 12 def invoke! validator.validate! case output_format when 'ascii' puts AsciiRenderer.new(validator.errors, color: color_enabled?).render when 'markdown' puts MarkdownRenderer.new(validator.errors, url_formatter: url_formatter).render else (1, 'Unsupported format: %s' % [output_format]) end exit validator.errors.size.zero? ? 0 : 1 end |
#output_format ⇒ Object
27 28 29 |
# File 'lib/i18n_flow/cli/lint_command.rb', line 27 def output_format @output_format ||= ['format'] || DEFAULT_FORMAT end |
#url_formatter ⇒ Object
31 32 33 34 35 |
# File 'lib/i18n_flow/cli/lint_command.rb', line 31 def url_formatter return @url_formatter if @url_formatter @url_formatter = ['url-formatter'] @url_formatter ||= "file://#{I18nFlow.config.base_path}/%f#%l" end |