| 
									
										
										
										
											2020-11-25 17:03:23 +01:00
										 |  |  | # typed: true | 
					
						
							| 
									
										
										
										
											2020-09-10 19:45:02 +02:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-14 13:16:26 -07:00
										 |  |  | require "cleanup" | 
					
						
							| 
									
										
										
										
											2020-09-10 19:45:02 +02:00
										 |  |  | require "cli/parser" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def autoremove_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							| 
									
										
										
										
											2021-01-15 15:04:02 -05:00
										 |  |  |       description <<~EOS | 
					
						
							| 
									
										
										
										
											2020-11-06 10:36:21 -05:00
										 |  |  |         Uninstall formulae that were only installed as a dependency of another formula and are now no longer needed. | 
					
						
							| 
									
										
										
										
											2020-09-10 19:45:02 +02:00
										 |  |  |       EOS | 
					
						
							|  |  |  |       switch "-n", "--dry-run", | 
					
						
							| 
									
										
										
										
											2020-11-06 10:36:21 -05:00
										 |  |  |              description: "List what would be uninstalled, but do not actually uninstall anything." | 
					
						
							| 
									
										
										
										
											2020-11-12 10:40:41 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-10 14:26:40 -05:00
										 |  |  |       named_args :none | 
					
						
							| 
									
										
										
										
											2020-09-10 19:45:02 +02:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def autoremove | 
					
						
							|  |  |  |     args = autoremove_args.parse | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-14 13:16:26 -07:00
										 |  |  |     Cleanup.autoremove(dry_run: args.dry_run?) | 
					
						
							| 
									
										
										
										
											2020-09-10 19:45:02 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | end |