 5ec5063dc7
			
		
	
	
		5ec5063dc7
		
			
		
	
	
	
	
		
			
			This uses the logic in `brew.sh` for deciding whether or not to run `brew update --auto-update` and makes it a dedicated command that can be used instead of `brew update` in scripts to be really fast in the no-op case. `brew update` will always do at least some updating which is a nicer default but is much slower.
		
			
				
	
	
		
			24 lines
		
	
	
		
			512 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			512 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # typed: strict
 | |
| # frozen_string_literal: true
 | |
| 
 | |
| require "abstract_command"
 | |
| require "shell_command"
 | |
| 
 | |
| module Homebrew
 | |
|   module Cmd
 | |
|     class UpdateIfNeeded < AbstractCommand
 | |
|       include ShellCommand
 | |
| 
 | |
|       cmd_args do
 | |
|         description <<~EOS
 | |
|           Runs `brew update --auto-update` only if needed.
 | |
|           This is a good replacement for `brew update` in scripts where you want
 | |
|           the no-op case to be both possible and really fast.
 | |
|         EOS
 | |
| 
 | |
|         named_args :none
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |