Class: Ucode::Cli::Audit

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

Overview

─────────────── audit ───────────────

Instance Method Summary collapse

Instance Method Details

#browserObject



654
655
656
657
658
659
660
661
# File 'lib/ucode/cli.rb', line 654

def browser
  result = Commands::Audit::BrowserCommand.new.call(
    input: options[:input],
    faces_only: options[:faces_only],
    library_only: options[:library_only],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#collection(path) ⇒ Object



572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/ucode/cli.rb', line 572

def collection(path)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::CollectionCommand.new.call(
    path,
    font_index: options[:font_index],
    label: options[:label],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#compare(left, right) ⇒ Object



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/ucode/cli.rb', line 634

def compare(left, right)
  result = Commands::Audit::CompareCommand.new.call(
    left, right,
    unicode_version: options[:unicode_version],
    output_file: options[:output],
  )
  if result.error
    warn "compare failed: #{result.error}"
    exit 1
  elsif options[:output].nil?
    puts result.text
  else
    puts "wrote #{options[:output]}"
  end
end

#font(path) ⇒ Object



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/ucode/cli.rb', line 534

def font(path)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::FontCommand.new.call(
    path,
    label: options[:label],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    install: !options[:no_install],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end

#library(dir) ⇒ Object



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/ucode/cli.rb', line 609

def library(dir)
  reference = Ucode::Audit::ReferenceFactory.build_from_cli(
    flag: options[:reference_universal_set],
    version: options[:unicode_version],
  )
  result = Commands::Audit::LibraryCommand.new.call(
    dir,
    recursive: options[:recursive],
    unicode_version: options[:unicode_version],
    verbose: options[:verbose],
    with_glyphs: options[:with_glyphs],
    brief: options[:brief],
    output_root: options[:output],
    browse: options[:browse],
    reference: reference,
    universal_set_root: options[:universal_set_root],
    with_missing_glyph_pages: options[:with_missing_glyph_pages],
  )
  puts JSON.pretty_generate(result_to_h(result))
end