Skip to content

Commit 06836b2

Browse files
authored
Update installation script to install AIShell module on macOS too (#374)
1 parent 3776879 commit 06836b2

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

shell/AIShell.Integration/AIShell.psm1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if ($IsMacOS -and $env:TERM_PROGRAM -ne "iTerm.app") {
2+
throw "The AIShell module requires iTerm2 to work properly. Please install and run from the iTerm2 terminal."
3+
}
4+
15
$module = Get-Module -Name PSReadLine
26
if ($null -eq $module -or $module.Version -lt [version]"2.4.2") {
37
throw "The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly."

tools/scripts/install-aishell.ps1

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function Install-AIShellApp {
9595

9696
if (-not $destinationExists) {
9797
# Create the directory if not existing.
98+
Write-Host "Creating the target folder '$destination' ..."
9899
if ($IsWindows) {
99100
$null = New-Item -Path $destination -ItemType Directory -Force
100101
} else {
@@ -204,13 +205,12 @@ function Uninstall-AIShellApp {
204205
}
205206

206207
function Install-AIShellModule {
207-
if ($IsWindows) {
208-
$modVersion = $Script:ModuleVersion
209-
Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..."
210-
Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue
211-
} else {
212-
Write-Host -ForegroundColor Yellow "Currently the AIShell PowerShell module will only work in iTerm2 terminal and still has limited support but if you would like to test it, you can install it with 'Install-PSResource -Name AIShell -Repository PSGallery -Prerelease'."
213-
Write-Host -ForegroundColor Yellow "The AI Shell app has been added to your path, please run 'aish' to use the standalone experience."
208+
$modVersion = $Script:ModuleVersion
209+
Write-Host "Installing the PowerShell module 'AIShell' $modVersion ..."
210+
Install-PSResource -Name AIShell -Repository PSGallery -Prerelease -TrustRepository -Version $modVersion -ErrorAction Stop -WarningAction SilentlyContinue
211+
212+
if ($IsMacOS) {
213+
Write-Host -ForegroundColor Yellow "NOTE: The 'AIShell' PowerShell module only works in iTerm2 terminal in order to provide the sidecar experience."
214214
}
215215
}
216216

@@ -237,12 +237,16 @@ if ($Uninstall) {
237237
Uninstall-AIShellApp
238238
Uninstall-AIShellModule
239239

240-
$message = $IsWindows ? "AI Shell App and PowerShell module have" : "AI Shell App has"
241-
Write-Host "`n$message been successfully uninstalled." -ForegroundColor Green
240+
Write-Host -ForegroundColor Green "`nAI Shell App and PowerShell module have been successfully uninstalled."
242241
} else {
243242
Install-AIShellApp
244243
Install-AIShellModule
245244

246-
$message = $IsWindows ? "'Start-AIShell'" : "'aish'"
247-
Write-Host "`nInstallation succeeded.`nTo learn more about AI Shell please visit https://aka.ms/AIShell-Docs.`nTo get started please run $message to start AI Shell." -ForegroundColor Green
245+
$condition = $IsMacOS ? " if you are in iTerm2" : $null
246+
Write-Host -ForegroundColor Green -Object @"
247+
248+
Installation succeeded.
249+
To learn more about AI Shell please visit https://aka.ms/AIShell-Docs.
250+
To get started, please run 'Start-AIShell' to use the sidecar experience${condition}, or run 'aish' to use the standalone experience.
251+
"@
248252
}

0 commit comments

Comments
 (0)