Class: Slidict::Cli::Lint
- Inherits:
-
Object
- Object
- Slidict::Cli::Lint
- Defined in:
- lib/slidict/cli/lint.rb
Overview
Implements slidict lint <file>: diagnoses whether a Markdown/Asciidoc
slide deck has a structure that an audience can actually follow (not
whether it looks nice). Diagnosis only -- it does not rewrite the file.
Constant Summary collapse
- ASCIIDOC_EXTENSIONS =
%w[.adoc .asciidoc].freeze
Instance Method Summary collapse
-
#initialize(output:, linter_factory: nil, renderer: Slidict::Lint::Renderer.new) ⇒ Lint
constructor
A new instance of Lint.
- #run(argv) ⇒ Object
Constructor Details
#initialize(output:, linter_factory: nil, renderer: Slidict::Lint::Renderer.new) ⇒ Lint
Returns a new instance of Lint.
11 12 13 14 15 |
# File 'lib/slidict/cli/lint.rb', line 11 def initialize(output:, linter_factory: nil, renderer: Slidict::Lint::Renderer.new) @output = output @linter_factory = linter_factory || method(:default_linter) @renderer = renderer end |
Instance Method Details
#run(argv) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/slidict/cli/lint.rb', line 17 def run(argv) = parse(argv) return print_help if [:help] || [:path].nil? return file_not_found([:path]) unless File.exist?([:path]) run_lint() rescue ArgumentError => e print_usage_error(e) rescue Slidict::Lint::Linter::Error, Llm::Client::Error => e print_error(e) end |