| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  | require "formula" | 
					
						
							|  |  |  | require "tab" | 
					
						
							| 
									
										
										
										
											2016-01-04 23:14:58 +01:00
										 |  |  | require "diagnostic" | 
					
						
							| 
									
										
										
										
											2019-04-17 18:25:08 +09:00
										 |  |  | require "cli/parser" | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-05 12:53:16 +05:30
										 |  |  |   def missing_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							|  |  |  |       usage_banner <<~EOS | 
					
						
							| 
									
										
										
										
											2019-08-06 14:17:17 -04:00
										 |  |  |         `missing` [<options>] [<formula>] | 
					
						
							| 
									
										
										
										
											2018-11-05 12:53:16 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |         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. | 
					
						
							| 
									
										
										
										
											2018-11-05 12:53:16 +05:30
										 |  |  |       EOS | 
					
						
							|  |  |  |       comma_array "--hide", | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |                   description: "Act as if none of the specified <hidden> are installed. <hidden> should be "\ | 
					
						
							| 
									
										
										
										
											2019-08-06 14:22:24 -04:00
										 |  |  |                                "a comma-separated list of formulae." | 
					
						
							| 
									
										
										
										
											2018-11-05 12:53:16 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |   def missing | 
					
						
							| 
									
										
										
										
											2020-07-30 18:40:10 +02:00
										 |  |  |     args = missing_args.parse | 
					
						
							| 
									
										
										
										
											2019-12-13 15:39:55 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     return unless HOMEBREW_CELLAR.exist? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-04 17:28:15 +00:00
										 |  |  |     ff = if args.no_named? | 
					
						
							| 
									
										
										
										
											2017-10-14 06:18:09 +01:00
										 |  |  |       Formula.installed.sort | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2020-08-19 10:34:48 -04:00
										 |  |  |       args.named.to_resolved_formulae.sort | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-05 21:14:43 +01:00
										 |  |  |     ff.each do |f| | 
					
						
							| 
									
										
										
										
											2018-11-05 12:53:16 +05:30
										 |  |  |       missing = f.missing_dependencies(hide: args.hide) | 
					
						
							| 
									
										
										
										
											2016-10-05 21:14:43 +01:00
										 |  |  |       next if missing.empty? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-12 22:35:51 -07:00
										 |  |  |       Homebrew.failed = true | 
					
						
							| 
									
										
										
										
											2016-10-05 21:14:43 +01:00
										 |  |  |       print "#{f}: " if ff.size > 1
 | 
					
						
							| 
									
										
										
										
											2016-10-22 13:32:46 +01:00
										 |  |  |       puts missing.join(" ") | 
					
						
							| 
									
										
										
										
											2012-06-11 12:57:51 -07:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |