Class: Lutaml::Xsd::Commands::SearchCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Lutaml::Xsd::Commands::SearchCommand
- Defined in:
- lib/lutaml/xsd/commands/search_command.rb
Overview
Search command implementation Searches for types by name or documentation with relevance ranking
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#initialize(query, package_path, options) ⇒ SearchCommand
constructor
A new instance of SearchCommand.
- #run ⇒ Object
Constructor Details
#initialize(query, package_path, options) ⇒ SearchCommand
Returns a new instance of SearchCommand.
12 13 14 15 16 |
# File 'lib/lutaml/xsd/commands/search_command.rb', line 12 def initialize(query, package_path, ) super() @query = query @package_path = package_path end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lutaml/xsd/commands/search_command.rb', line 18 def run repository = load_repository(@package_path) repository = ensure_resolved(repository) # Store package root for path display @package_root = if @package_path.end_with?(".lxr") # For LXR packages, get the temp extraction dir repository.instance_variable_get(:@temp_extraction_dir) || Dir.pwd else # For other formats, use parent directory of first file repository.files&.first ? File.dirname(repository.files.first) : Dir.pwd end search_and_display(repository) end |