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



406
407
408
409
410
411
412
413
414
# File 'lib/ucode/cli.rb', line 406

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



431
432
433
434
435
436
437
438
439
# File 'lib/ucode/cli.rb', line 431

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



418
419
420
421
422
423
424
425
426
# File 'lib/ucode/cli.rb', line 418

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