| 
									
										
										
										
											2024-03-31 19:49:25 -07:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-31 19:49:25 -07:00
										 |  |  | require "abstract_command" | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  | require "formula" | 
					
						
							|  |  |  | require "tab" | 
					
						
							| 
									
										
										
										
											2016-01-04 23:14:58 +01:00
										 |  |  | require "diagnostic" | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2024-03-31 19:49:25 -07:00
										 |  |  |   module Cmd | 
					
						
							|  |  |  |     class Missing < AbstractCommand | 
					
						
							|  |  |  |       cmd_args do | 
					
						
							|  |  |  |         description <<~EOS | 
					
						
							|  |  |  |           Check the given <formula> kegs for missing dependencies. If no <formula> are | 
					
						
							|  |  |  |           provided, check all kegs. Will exit with a non-zero status if any kegs are found | 
					
						
							|  |  |  |           to be missing dependencies. | 
					
						
							|  |  |  |         EOS | 
					
						
							|  |  |  |         comma_array "--hide", | 
					
						
							|  |  |  |                     description: "Act as if none of the specified <hidden> are installed. <hidden> should be " \ | 
					
						
							|  |  |  |                                  "a comma-separated list of formulae." | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         named_args :formula | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { override.void } | 
					
						
							|  |  |  |       def run | 
					
						
							|  |  |  |         return unless HOMEBREW_CELLAR.exist? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ff = if args.no_named? | 
					
						
							|  |  |  |           Formula.installed.sort | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           args.named.to_resolved_formulae.sort | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ff.each do |f| | 
					
						
							|  |  |  |           missing = f.missing_dependencies(hide: args.hide) | 
					
						
							|  |  |  |           next if missing.empty? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Homebrew.failed = true | 
					
						
							|  |  |  |           print "#{f}: " if ff.size > 1
 | 
					
						
							|  |  |  |           puts missing.join(" ") | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |