Class: Ucode::Cli::Lookup

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

Overview

─────────────── lookup ───────────────

Instance Method Summary collapse

Instance Method Details

#block(codepoint) ⇒ Object



263
264
265
266
267
268
269
270
271
# File 'lib/ucode/cli.rb', line 263

def block(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new.lookup_block(
      VersionResolver.resolve(options[:version]), codepoint: cp,
    )
    puts "#{format("U+%04X", cp)}#{result.block || "(unassigned)"}"
  end
end

#char(codepoint) ⇒ Object



288
289
290
291
292
293
294
295
296
# File 'lib/ucode/cli.rb', line 288

def char(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new
      .lookup_char(VersionResolver.resolve(options[:version]),
                   codepoint: cp, output_root: options[:from])
    puts "#{format("U+%04X", cp)} block=#{result.block_id} glyph=#{result.glyph_path}"
  end
end

#script(codepoint) ⇒ Object



275
276
277
278
279
280
281
282
283
# File 'lib/ucode/cli.rb', line 275

def script(codepoint)
  cp = parse_cp(codepoint)
  with_db_handling do
    result = Commands::LookupCommand.new.lookup_script(
      VersionResolver.resolve(options[:version]), codepoint: cp,
    )
    puts "#{format("U+%04X", cp)}#{result.script || "(none)"}"
  end
end