Module: Ukiryu::ExecutableLocator::AliasDiscovery Private

Defined in:
lib/ukiryu/executable_locator.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Alias-based discovery (delegates to Shell class)

Class Method Summary collapse

Class Method Details

.discover(command, context) ⇒ Hash?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Discover executable via shell alias

Parameters:

  • command (String)

    the command to locate

  • context (DiscoveryContext)

    discovery environment

Returns:

  • (Hash, nil)

    discovery result or nil



147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/ukiryu/executable_locator.rb', line 147

def discover(command, context)
  warn "[UKIRYU DEBUG AliasDiscovery] Checking for alias: #{command.inspect} with shell #{context.shell_class}" if ENV['UKIRYU_DEBUG_EXECUTABLE'] || (context.platform == :windows && ENV['CI'])

  alias_info = context.shell_class.detect_alias(command)
  warn "[UKIRYU DEBUG AliasDiscovery] Alias info: #{alias_info.inspect}" if ENV['UKIRYU_DEBUG_EXECUTABLE'] || (context.platform == :windows && ENV['CI'])
  return nil unless alias_info

  alias_target = alias_info[:target]
  path = PathScanner.find(command) || PathScanner.find(alias_target)

  warn "[UKIRYU DEBUG AliasDiscovery] Alias target: #{alias_target.inspect}, path: #{path.inspect}" if ENV['UKIRYU_DEBUG_EXECUTABLE'] || (context.platform == :windows && ENV['CI'])

  DiscoveryResult.build(path, :alias, context, alias_info[:definition]) if path
end