Casks/p/powershell.rb
cask "powershell" do
arch arm: "arm64", intel: "x64"
version "7.4.5"
sha256 arm: "2ac31bae7373354b4e54ece8bbc09c7b823b2f17be593241ab8faa972001a189",
intel: "cdffc02150ebe9c0c4ede68fb9016a62f08e46d38427d4b5c80cdba60c0f0c16"
url "https://github.com/PowerShell/PowerShell/releases/download/v#{version}/powershell-#{version}-osx-#{arch}.pkg"
name "PowerShell"
desc "Command-line shell and scripting language"
homepage "https://github.com/PowerShell/PowerShell"
livecheck do
url :url
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
depends_on formula: "openssl"
depends_on macos: ">= :mojave"
pkg "powershell-#{version}-osx-#{arch}.pkg"
uninstall pkgutil: "com.microsoft.powershell"
zap trash: [
"~/.cache/powershell",
"~/.config/powershell",
"~/.local/share/powershell",
]
caveats <<~EOS
To use Homebrew in PowerShell, run the following in a PowerShell session:
New-Item -Path (Split-Path -Parent -Path $PROFILE.CurrentUserAllHosts) -ItemType Directory -Force
Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(#{HOMEBREW_PREFIX}/bin/brew shellenv) | Invoke-Expression'
EOS
end