Class: Slidict::Cli::Lint

Inherits:
Object
  • Object
show all
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

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)
  options = parse(argv)
  return print_help if options[:help] || options[:path].nil?
  return file_not_found(options[:path]) unless File.exist?(options[:path])

  run_lint(options)
rescue ArgumentError => e
  print_usage_error(e)
rescue Slidict::Lint::Linter::Error, Llm::Client::Error => e
  print_error(e)
end