Class: Ukiryu::CliCommands::WhichCommand

Inherits:
BaseCommand show all
Defined in:
lib/ukiryu/cli_commands/which_command.rb

Overview

Show which tool implementation would be selected

Instance Attribute Summary

Attributes inherited from BaseCommand

#config, #options

Instance Method Summary collapse

Methods inherited from BaseCommand

#apply_cli_options_to_config, #default_register_path, #initialize, #setup_register, #stringify_keys

Constructor Details

This class inherits a constructor from Ukiryu::CliCommands::BaseCommand

Instance Method Details

#run(identifier) ⇒ Object

Execute the which command

Parameters:

  • identifier (String)

    the tool name, interface, or alias



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ukiryu/cli_commands/which_command.rb', line 10

def run(identifier)
  setup_register

  runtime = Ukiryu::Runtime.instance
  platform = options[:platform] || runtime.platform
  shell = options[:shell] || runtime.shell

  say '', :clear
  say "Resolving: #{identifier}", :cyan
  say "  Platform: #{platform}", :white
  say "  Shell: #{shell}", :white
  say '', :clear

  # First try exact name match
  tool = try_exact_match(identifier, platform, shell)

  # If not found, try interface/alias discovery
  tool ||= try_interface_discovery(identifier, platform, shell)

  if tool
    show_selected_tool(tool, identifier, platform, shell)
  else
    error! "No tool found for: #{identifier}\nAvailable tools: #{Ukiryu::Register.tools.sort.join(', ')}"
  end
end