Class: Ucode::Cli::CodeChartCmd

Inherits:
Thor
  • Object
show all
Defined in:
lib/ucode/cli.rb

Overview

─────────────── code-chart ─────────────── Extract per-codepoint SVG glyphs from a Unicode Code Charts PDF. One folder per block under --to, with <U+XXXX>.svg + .json pairs.

Instance Method Summary collapse

Instance Method Details

#extract(version = nil) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/ucode/cli.rb', line 161

def extract(version = nil)
  with_codechart_errors do
    version_str = VersionResolver.resolve(version)

    if options[:missing_from]
      run_batch_extract(version: version_str,
                        manifest_path: options[:missing_from],
                        to: options[:to], verify: options[:verify])
    else
      raise Thor::Error, "--block is required when --missing-from is not set" unless options[:block]

      run_single_block_extract(version: version_str,
                               block_id: options[:block],
                               to: options[:to], verify: options[:verify])
    end
  end
end

#fetch(version = nil) ⇒ Object



140
141
142
143
144
145
146
147
148
149
# File 'lib/ucode/cli.rb', line 140

def fetch(version = nil)
  with_codechart_errors do
    block_first_cp = resolve_block_first_cp!(options[:block], version)
    result = Commands::FetchCommand.new.fetch_charts(
      VersionResolver.resolve(version),
      block_first_cps: [block_first_cp],
    )
    puts JSON.pretty_generate(result)
  end
end

#listObject



184
185
186
187
188
189
190
191
192
# File 'lib/ucode/cli.rb', line 184

def list
  with_codechart_errors do
    if options[:coverage_gap_only]
      run_coverage_gap_list
    else
      run_simple_list
    end
  end
end