| 
									
										
										
										
											2024-07-14 16:18:26 -04:00
										 |  |  | # typed: strict | 
					
						
							|  |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require "abstract_command" | 
					
						
							| 
									
										
										
										
											2024-07-15 11:40:01 -04:00
										 |  |  | require "shell_command" | 
					
						
							| 
									
										
										
										
											2024-07-14 16:18:26 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   module Cmd | 
					
						
							|  |  |  |     class Shellenv < AbstractCommand | 
					
						
							| 
									
										
										
										
											2024-07-15 11:40:01 -04:00
										 |  |  |       include ShellCommand | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-14 16:18:26 -04:00
										 |  |  |       cmd_args do | 
					
						
							|  |  |  |         description <<~EOS | 
					
						
							|  |  |  |           Valid shells: bash|csh|fish|pwsh|sh|tcsh|zsh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           Print export statements. When run in a shell, this installation of Homebrew will be added to your `PATH`, `MANPATH`, and `INFOPATH`. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-27 14:21:27 +00:00
										 |  |  |           The variables `$HOMEBREW_PREFIX`, `$HOMEBREW_CELLAR` and `$HOMEBREW_REPOSITORY` are also exported to avoid | 
					
						
							|  |  |  |           querying them multiple times. | 
					
						
							|  |  |  |           To help guarantee idempotence, this command produces no output when Homebrew's `bin` and `sbin` directories | 
					
						
							|  |  |  |           are first and second respectively in your `PATH`. Consider adding evaluation of this command's output to | 
					
						
							| 
									
										
										
										
											2025-01-27 15:12:50 +00:00
										 |  |  |           your dotfiles (e.g. `~/.bash_profile` or ~/.zprofile` on macOS and ~/.bashrc` or ~/.zshrc` on Linux) with: | 
					
						
							|  |  |  |             `eval "$(brew shellenv)"` | 
					
						
							| 
									
										
										
										
											2024-07-14 16:18:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-27 14:21:27 +00:00
										 |  |  |           The shell can be specified explicitly with a supported shell name parameter. Unknown shells will output | 
					
						
							|  |  |  |           POSIX exports. | 
					
						
							| 
									
										
										
										
											2024-07-14 16:18:26 -04:00
										 |  |  |         EOS | 
					
						
							|  |  |  |         named_args :shell | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |