| 
									
										
										
										
											2016-04-08 16:28:43 +02:00
										 |  |  | #:  * `unlink` [`--dry-run`] <formula>: | 
					
						
							|  |  |  | #:    Remove symlinks for <formula> from the Homebrew prefix. This can be useful | 
					
						
							|  |  |  | #:    for temporarily disabling a formula: | 
					
						
							| 
									
										
										
										
											2017-02-25 17:37:57 -05:00
										 |  |  | #:    `brew unlink <formula> && <commands> && brew link <formula>` | 
					
						
							| 
									
										
										
										
											2016-04-08 16:28:43 +02:00
										 |  |  | #: | 
					
						
							|  |  |  | #:    If `--dry-run` or `-n` is passed, Homebrew will list all files which would | 
					
						
							|  |  |  | #:    be unlinked, but will not actually unlink or delete any files. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-06 15:25:36 +08:00
										 |  |  | require "ostruct" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   def unlink | 
					
						
							| 
									
										
										
										
											2012-03-19 14:11:25 +00:00
										 |  |  |     raise KegUnspecifiedError if ARGV.named.empty? | 
					
						
							| 
									
										
										
										
											2012-02-04 00:01:29 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-06 15:25:36 +08:00
										 |  |  |     mode = OpenStruct.new | 
					
						
							|  |  |  |     mode.dry_run = true if ARGV.dry_run? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     ARGV.kegs.each do |keg| | 
					
						
							| 
									
										
										
										
											2015-09-06 15:25:36 +08:00
										 |  |  |       if mode.dry_run | 
					
						
							|  |  |  |         puts "Would remove:" | 
					
						
							|  |  |  |         keg.unlink(mode) | 
					
						
							|  |  |  |         next | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |       keg.lock do | 
					
						
							|  |  |  |         print "Unlinking #{keg}... " | 
					
						
							| 
									
										
										
										
											2014-03-26 21:51:27 -05:00
										 |  |  |         puts if ARGV.verbose? | 
					
						
							| 
									
										
										
										
											2015-09-06 15:25:36 +08:00
										 |  |  |         puts "#{keg.unlink(mode)} symlinks removed" | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:25 -06:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |