Class: Ucode::Cli
- Inherits:
-
Thor
show all
- Defined in:
- lib/ucode/cli.rb
Overview
Top-level CLI entry.
Thin Thor: every method delegates to a Commands::*Command
class and only formats the result. The Command classes are pure
and testable in-process — Thor never holds business logic.
Version resolution lives here — each top-level command resolves
the user-supplied intent (nil / :default / :latest / explicit string)
exactly once via VersionResolver.resolve and threads the resolved
string into the dispatched Command. Sub-commands never re-resolve.
See Candidate 4 of the 2026-06-29 architecture review.
Defined Under Namespace
Classes: Audit, Cache, CodeChartCmd, Fetch, Lookup, Site, UniversalSetCmd
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
24
25
26
|
# File 'lib/ucode/cli.rb', line 24
def self.exit_on_failure?
true
end
|
Instance Method Details
#block_feed ⇒ Object
645
646
647
648
649
650
651
652
|
# File 'lib/ucode/cli.rb', line 645
def block_feed
result = Commands::BlockFeedCommand.new.call(
ucode_output_root: options[:ucode_output],
block_feed_output_root: options[:target],
unicode_version: options[:unicode_version],
)
puts JSON.pretty_generate(result.to_h)
end
|
#build(version = nil) ⇒ Object
324
325
326
327
328
329
330
331
332
|
# File 'lib/ucode/cli.rb', line 324
def build(version = nil)
result = Commands::BuildCommand.new.call(
version,
output_root: options[:to],
site_root: options[:site],
force_fetch: options[:force_fetch],
)
puts JSON.pretty_generate(result)
end
|
657
658
659
660
661
662
663
664
|
# File 'lib/ucode/cli.rb', line 657
def emit_metadata(version = nil)
version_str = VersionResolver.resolve(version)
result = Commands::EmitMetadataCommand.new.call(
version_str,
gem_root: options[:gem_root],
)
puts JSON.pretty_generate(result)
end
|
#parse(version = nil) ⇒ Object
#release ⇒ Object
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
|
# File 'lib/ucode/cli.rb', line 606
def release
reference = Ucode::Audit::ReferenceFactory.build_from_cli(
flag: options[:reference_universal_set],
version: options[:unicode_version],
)
result = Commands::ReleaseCommand.new.call(
from: options[:from],
output_root: options[:output],
universal_set_root: options[:universal_set],
unicode_version: options[:unicode_version],
brief: options[:brief],
browse: options[:browse],
source_config_sha256: options[:source_config_sha256],
reference: reference,
)
puts JSON.pretty_generate(result_to_h(result))
end
|
#version ⇒ Object
30
31
32
|
# File 'lib/ucode/cli.rb', line 30
def version
puts "ucode #{Ucode::VERSION}"
end
|