mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-21 02:55:37 -08:00
feat(windows): add install script for PowerShell
This commit is contained in:
parent
2b92304c77
commit
0a8b97bf27
|
@ -27,10 +27,13 @@ When using oh-my-posh inside the WSL, make sure to follow the [linux][linux] ins
|
|||
values={[
|
||||
{ label: 'winget', value: 'winget', },
|
||||
{ label: 'scoop', value: 'scoop', },
|
||||
{ label: 'manual', value: 'manual', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="winget">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
winget install JanDeDobbeleer.OhMyPosh
|
||||
```
|
||||
|
@ -38,10 +41,21 @@ winget install JanDeDobbeleer.OhMyPosh
|
|||
</TabItem>
|
||||
<TabItem value="scoop">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="manual">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
@ -53,9 +67,9 @@ This installs a couple of things:
|
|||
For the `$PATH` to reload, a restart of your terminal is advised.
|
||||
|
||||
:::warning Antivirus software
|
||||
Due to frequent updates of Oh My Posh, Antivirus software occasionally flags it (false positive).
|
||||
To ensure Oh My Posh isn't blocked you can either report it to your favorite Antivirus software as false positive
|
||||
(e.g. [Report a false positive/negative to Microsoft for analysis][report-false-positive]) or create an exclusion for it.
|
||||
Due to frequent updates of Oh My Posh, Antivirus software occasionally flags it (false positive).
|
||||
To ensure Oh My Posh isn't blocked you can either report it to your favorite Antivirus software as false positive
|
||||
(e.g. [Report a false positive/negative to Microsoft for analysis][report-false-positive]) or create an exclusion for it.
|
||||
Exclusions should be added with the full path to the executable, you can get it with the following command from a PowerShell prompt:
|
||||
|
||||
```powershell
|
||||
|
@ -71,10 +85,13 @@ Exclusions should be added with the full path to the executable, you can get it
|
|||
values={[
|
||||
{ label: 'winget', value: 'winget', },
|
||||
{ label: 'scoop', value: 'scoop', },
|
||||
{ label: 'manual', value: 'manual', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="winget">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
winget upgrade JanDeDobbeleer.OhMyPosh
|
||||
```
|
||||
|
@ -82,10 +99,21 @@ winget upgrade JanDeDobbeleer.OhMyPosh
|
|||
</TabItem>
|
||||
<TabItem value="scoop">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
scoop update oh-my-posh
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="manual">
|
||||
|
||||
Open a PowerShell prompt and run the following command:
|
||||
|
||||
```powershell
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
@ -97,6 +125,7 @@ scoop update oh-my-posh
|
|||
values={[
|
||||
{ label: 'winget', value: 'winget', },
|
||||
{ label: 'scoop', value: 'scoop', },
|
||||
{ label: 'manual', value: 'manual', },
|
||||
]
|
||||
}>
|
||||
<TabItem value="winget">
|
||||
|
@ -112,6 +141,13 @@ You can find the themes scoop installs inside the `"$(scoop prefix oh-my-posh)\t
|
|||
To use `jandedobbeleer.omp.json` for example, you can refer to it using `"$(scoop prefix oh-my-posh)\themes\jandedobbeleer.omp.json"`
|
||||
when setting the prompt using the `--config` flag.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="manual">
|
||||
|
||||
You can find the themes winget installs inside the `$env:POSH_THEMES_PATH` folder.
|
||||
To use `jandedobbeleer.omp.json` for example, you can refer to it using `$env:POSH_THEMES_PATH\jandedobbeleer.omp.json`
|
||||
when setting the prompt using the `--config` flag.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
|
|
54
docs/static/install.ps1
vendored
Normal file
54
docs/static/install.ps1
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
$installInstructions = @'
|
||||
Hey friend
|
||||
|
||||
This installer is only available for Windows.
|
||||
If you're looking for installation instructions for your operating system,
|
||||
please visit the following link:
|
||||
'@
|
||||
if ($IsMacOS) {
|
||||
Write-Host @"
|
||||
$installInstructions
|
||||
|
||||
https://ohmyposh.dev/docs/installation/macos
|
||||
"@
|
||||
exit
|
||||
}
|
||||
if ($IsLinux) {
|
||||
Write-Host @"
|
||||
$installInstructions
|
||||
|
||||
https://ohmyposh.dev/docs/installation/linux
|
||||
"@
|
||||
exit
|
||||
}
|
||||
$installer = ''
|
||||
$arch = (Get-CimInstance -Class Win32_Processor -Property Architecture).Architecture
|
||||
switch ($arch) {
|
||||
0 { $installer = "install-386.exe" } # x86
|
||||
5 { $installer = "install-arm64.exe" } # ARM
|
||||
9 { $installer = "install-amd64.exe" } # x64
|
||||
12 { $installer = "install-amd64.exe" } # x64 emulated on Surface Pro X
|
||||
}
|
||||
|
||||
if ($installer -eq '') {
|
||||
Write-Host @"
|
||||
The installer for system architecture ($arch) is not available.
|
||||
"@
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "Downloading $installer..."
|
||||
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'exe' } -PassThru
|
||||
$url = "https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/$installer"
|
||||
Invoke-WebRequest -OutFile $tmp $url
|
||||
Write-Host 'Running installer...'
|
||||
& "$tmp" /VERYSILENT | Out-Null
|
||||
$tmp | Remove-Item
|
||||
Write-Host @'
|
||||
Done!
|
||||
|
||||
Restart your terminal and have a look at the
|
||||
documentation on how to proceed from here.
|
||||
|
||||
https://ohmyposh.dev/docs/installation/prompt
|
||||
'@
|
Loading…
Reference in a new issue