brew/Library/Homebrew/cmd/shellenv.rb
Mike McQuaid 5987c5c1d0
Add stub Ruby commands for all Bash commands.
This gets us pretty similar (but easier to manage) manpage output but
much nicer completions etc. for all these commands.
2024-07-14 23:12:53 -04:00

30 lines
1.1 KiB
Ruby

# typed: strict
# frozen_string_literal: true
require "abstract_command"
module Homebrew
module Cmd
class Shellenv < AbstractCommand
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`.
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 your dotfiles (e.g. `~/.bash_profile` or
`~/.zprofile` on macOS and `~/.bashrc` or `~/.zshrc` on Linux) with: `eval "$(brew shellenv)"`
The shell can be specified explicitly with a supported shell name parameter. Unknown shells will output POSIX exports.
EOS
named_args :shell
end
sig { override.void }
def run = raise_sh_command_error!
end
end
end