Class: Suma::Cli::Core

Inherits:
Thor
  • Object
show all
Extended by:
ThorExt::Start
Defined in:
lib/suma/cli/core.rb

Overview

Top-level CLI entrypoint.

Each command delegates to a dedicated Thor class under Suma::Cli::, which reparses ARGV and therefore owns the canonical option declarations. Re-declaring options here would duplicate the inner classes' declarations and cause help text and validation logic to drift. Options are declared in exactly one place (the inner class).

The exception is check_svg_quality, which constructs its analyzer inline (no inner Thor class), so its options belong here.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThorExt::Start

extended, start

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/suma/cli/core.rb', line 142

def self.exit_on_failure?
  true
end

Instance Method Details

#build(_site_manifest) ⇒ Object



24
25
26
# File 'lib/suma/cli/core.rb', line 24

def build(_site_manifest)
  Cli::Build.start
end

#check_svg_quality(path = Cli::CheckSvgQuality::DATA_PATH) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/suma/cli/core.rb', line 124

def check_svg_quality(path = Cli::CheckSvgQuality::DATA_PATH)
  analyzer = Cli::CheckSvgQuality.new(
    pattern: options[:pattern],
    profile: options[:profile],
    format: options[:format],
    output: options[:output],
    min_errors: options[:min_errors],
    summary_only: options[:summary_only],
    progress: options[:progress],
    limit: options[:limit],
    sort: options[:sort],
  )
  analyzer.run(path)
end

#compare(_trial_schema, _reference_schema) ⇒ Object



96
97
98
# File 'lib/suma/cli/core.rb', line 96

def compare(_trial_schema, _reference_schema)
  Cli::Compare.start
end

#convert_jsdai(_xml_file, _image_file, _output_dir) ⇒ Object



83
84
85
# File 'lib/suma/cli/core.rb', line 83

def convert_jsdai(_xml_file, _image_file, _output_dir)
  Cli::ConvertJsdai.start
end

#export(*_files) ⇒ Object



90
91
92
# File 'lib/suma/cli/core.rb', line 90

def export(*_files)
  Cli::Export.start
end

#extract_terms(schema_manifest_file, glossarist_output_path) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/suma/cli/core.rb', line 48

def extract_terms(schema_manifest_file, glossarist_output_path)
  TermExtractor.new(
    schema_manifest_file,
    glossarist_output_path,
    urn: options[:urn],
    language_code: options[:language_code],
  ).call
end

#generate_register(schema_manifest_file, output_path) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/suma/cli/core.rb', line 69

def generate_register(schema_manifest_file, output_path)
  RegisterManifestGenerator.new(
    schema_manifest_file,
    output_path,
    urn: options[:urn],
    id: options[:id],
    ref: options[:ref],
    language_code: options[:language_code],
    owner: options[:owner],
  ).generate
end

#generate_schemas(_metanorma_manifest_file, _schema_manifest_file) ⇒ Object



30
31
32
# File 'lib/suma/cli/core.rb', line 30

def generate_schemas(_metanorma_manifest_file, _schema_manifest_file)
  Cli::GenerateSchemas.start
end

#reformat(_express_file_path) ⇒ Object



36
37
38
# File 'lib/suma/cli/core.rb', line 36

def reformat(_express_file_path)
  Cli::Reformat.start
end