| 
									
										
										
										
											2016-04-08 16:28:43 +02:00
										 |  |  | #:  * `command` <cmd>: | 
					
						
							|  |  |  | #:    Display the path to the file which is used when invoking `brew` <cmd>. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-07 20:09:22 +01:00
										 |  |  | require "commands" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-26 15:19:27 +08:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-26 15:19:27 +08:00
										 |  |  |   def command | 
					
						
							| 
									
										
										
										
											2015-09-29 15:39:08 +02:00
										 |  |  |     abort "This command requires a command argument" if ARGV.empty? | 
					
						
							| 
									
										
										
										
											2015-06-26 15:19:27 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-05 15:37:57 +00:00
										 |  |  |     cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(ARGV.first, ARGV.first) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     path = Commands.path(cmd) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     cmd_paths = PATH.new(ENV["PATH"]).append(Tap.cmd_directories) unless path | 
					
						
							|  |  |  |     path ||= which("brew-#{cmd}", cmd_paths) | 
					
						
							|  |  |  |     path ||= which("brew-#{cmd}.rb", cmd_paths) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     odie "Unknown command: #{cmd}" unless path | 
					
						
							|  |  |  |     puts path | 
					
						
							| 
									
										
										
										
											2015-06-26 15:19:27 +08:00
										 |  |  |   end | 
					
						
							|  |  |  | end |