mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat: winget support
This commit is contained in:
parent
8ef355db4c
commit
c8ef9edc77
22
.github/workflows/release.yml
vendored
22
.github/workflows/release.yml
vendored
|
@ -237,6 +237,8 @@ jobs:
|
||||||
needs: [release, artifacts]
|
needs: [release, artifacts]
|
||||||
if: ${{ needs.release.outputs.skipped == 'false' }}
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
outputs:
|
||||||
|
hash: ${{ steps.hash.outputs.hash_inno }}
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
@ -246,6 +248,11 @@ jobs:
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Build installer
|
- name: Build installer
|
||||||
run: ./build.ps1 -Version ${{ needs.release.outputs.version }}
|
run: ./build.ps1 -Version ${{ needs.release.outputs.version }}
|
||||||
|
- name: Output Hash
|
||||||
|
id: hash
|
||||||
|
run: |
|
||||||
|
$hash = Get-Content -Path Output/install.exe.sha256
|
||||||
|
Write-Output "::set-output name=hash_inno::$($hash)"
|
||||||
- name: Upload Inno Installer
|
- name: Upload Inno Installer
|
||||||
id: upload-inno-installer
|
id: upload-inno-installer
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
|
@ -266,3 +273,18 @@ jobs:
|
||||||
asset_path: ${{ github.workspace }}/packages/inno/Output/install.exe.sha256
|
asset_path: ${{ github.workspace }}/packages/inno/Output/install.exe.sha256
|
||||||
asset_name: install.exe.sha256
|
asset_name: install.exe.sha256
|
||||||
asset_content_type: text/plain
|
asset_content_type: text/plain
|
||||||
|
winget:
|
||||||
|
needs: [release, inno]
|
||||||
|
if: ${{ needs.release.outputs.skipped == 'false' }}
|
||||||
|
runs-on: windows-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: pwsh
|
||||||
|
working-directory: ${{ github.workspace }}/packages/winget
|
||||||
|
env:
|
||||||
|
WINGETCREATE_TOKEN: ${{ secrets.WINGETCREATE_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Create manifest and submit PR
|
||||||
|
run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -Hash ${{ needs.inno.outputs.hash }} -Token $env:WINGETCREATE_TOKEN
|
||||||
|
|
|
@ -16,6 +16,33 @@ While Oh my Posh works on the standard terminal, we advise using the [Windows Te
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="winget"
|
||||||
|
groupId="install"
|
||||||
|
values={[
|
||||||
|
{ label: 'winget', value: 'winget', },
|
||||||
|
{ label: 'scoop', value: 'scoop', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="winget">
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
winget install JanDeDobbeleer.OhMyPosh
|
||||||
|
```
|
||||||
|
|
||||||
|
This installs a couple of things:
|
||||||
|
|
||||||
|
- `oh-my-posh.exe` - Windows executable, added to your `$PATH`
|
||||||
|
- `oh-my-posh-wsl` - Linux executable, added to your `$PATH` for use in the WSL
|
||||||
|
- `themes` - The latest Oh my Posh themes
|
||||||
|
|
||||||
|
If you want to use a standard theme, you can find them in `~\AppData\Local\Programs\oh-my-posh\themes\`,
|
||||||
|
referencing them as such
|
||||||
|
will always keep them compatible with the binary when updating Oh my Posh.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="scoop">
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
|
scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
|
||||||
```
|
```
|
||||||
|
@ -30,12 +57,27 @@ If you want to use a standard theme, you can find them in `~\scoop\apps\oh-my-po
|
||||||
referencing them as such
|
referencing them as such
|
||||||
will always keep them compatible with the binary when updating Oh my Posh.
|
will always keep them compatible with the binary when updating Oh my Posh.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
|
For the `$PATH` to reload, a reboot is advised.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
#### Preview the themes
|
#### Preview the themes
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="winget"
|
||||||
|
groupId="install"
|
||||||
|
values={[
|
||||||
|
{ label: 'winget', value: 'winget', },
|
||||||
|
{ label: 'scoop', value: 'scoop', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="winget">
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
Get-ChildItem -Path "$(scoop prefix oh-my-posh)/themes/*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
|
Get-ChildItem -Path "~\AppData\Local\Programs\oh-my-posh\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
|
||||||
$esc = [char]27
|
$esc = [char]27
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
|
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
|
||||||
|
@ -45,18 +87,75 @@ Get-ChildItem -Path "$(scoop prefix oh-my-posh)/themes/*" -Include '*.omp.json'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="scoop">
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Get-ChildItem -Path "$(scoop prefix oh-my-posh)\themes\*" -Include '*.omp.json' | Sort-Object Name | ForEach-Object -Process {
|
||||||
|
$esc = [char]27
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "$esc[1m$($_.BaseName)$esc[0m"
|
||||||
|
Write-Host ""
|
||||||
|
oh-my-posh --config $($_.FullName) --pwd $PWD
|
||||||
|
Write-Host ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
#### Update
|
#### Update
|
||||||
|
|
||||||
|
<Tabs
|
||||||
|
defaultValue="winget"
|
||||||
|
groupId="install"
|
||||||
|
values={[
|
||||||
|
{ label: 'winget', value: 'winget', },
|
||||||
|
{ label: 'scoop', value: 'scoop', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="winget">
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
winget upgrade JanDeDobbeleer.OhMyPosh
|
||||||
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="scoop">
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
scoop update oh-my-posh
|
scoop update oh-my-posh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
### Replace your existing prompt
|
### Replace your existing prompt
|
||||||
|
|
||||||
You can find the themes scoop installs inside the `"$(scoop prefix oh-my-posh)/themes/"` folder.
|
<Tabs
|
||||||
To use `jandedobbeleer.omp.json` for example, you can refer to it using `"$(scoop prefix oh-my-posh)/themes/jandedobbeleer.omp.json"`
|
defaultValue="winget"
|
||||||
|
groupId="install"
|
||||||
|
values={[
|
||||||
|
{ label: 'winget', value: 'winget', },
|
||||||
|
{ label: 'scoop', value: 'scoop', },
|
||||||
|
]
|
||||||
|
}>
|
||||||
|
<TabItem value="winget">
|
||||||
|
|
||||||
|
You can find the themes scoop installs inside the `~\AppData\Local\Programs\oh-my-posh\themes\` folder.
|
||||||
|
To use `jandedobbeleer.omp.json` for example, you can refer to it using `~\AppData\Local\Programs\oh-my-posh\themes\jandedobbeleer.omp.json"`
|
||||||
when setting the prompt using the `--config` flag.
|
when setting the prompt using the `--config` flag.
|
||||||
|
|
||||||
|
</TabItem>
|
||||||
|
<TabItem value="scoop">
|
||||||
|
|
||||||
|
You can find the themes scoop installs inside the `"$(scoop prefix oh-my-posh)\themes\"` folder.
|
||||||
|
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>
|
||||||
|
</Tabs>
|
||||||
|
|
||||||
The guides below use an imaginary theme called `mytheme.omp.json`, so make sure to replace that with your own, or one of the
|
The guides below use an imaginary theme called `mytheme.omp.json`, so make sure to replace that with your own, or one of the
|
||||||
included themes.
|
included themes.
|
||||||
|
|
||||||
|
|
15
packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml
Normal file
15
packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
PackageIdentifier: JanDeDobbeleer.OhMyPosh
|
||||||
|
PackageVersion: <VERSION>
|
||||||
|
InstallModes:
|
||||||
|
- "silent"
|
||||||
|
Installers:
|
||||||
|
- Architecture: x64
|
||||||
|
InstallerType: inno
|
||||||
|
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install.exe
|
||||||
|
InstallerSha256: <HASH>
|
||||||
|
- Architecture: x86
|
||||||
|
InstallerType: inno
|
||||||
|
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install.exe
|
||||||
|
InstallerSha256: <HASH>
|
||||||
|
ManifestType: "installer"
|
||||||
|
ManifestVersion: 1.0.0
|
22
packages/winget/JanDeDobbeleer.OhMyPosh.locale.en-US.yaml
Normal file
22
packages/winget/JanDeDobbeleer.OhMyPosh.locale.en-US.yaml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
PackageIdentifier: JanDeDobbeleer.OhMyPosh
|
||||||
|
PackageVersion: <VERSION>
|
||||||
|
PackageLocale: en-US
|
||||||
|
Publisher: Jan De Dobbeleer
|
||||||
|
PackageName: Oh My Posh
|
||||||
|
License: GPL
|
||||||
|
ShortDescription: Prompt theme engine for any shell
|
||||||
|
Tags:
|
||||||
|
- "Console"
|
||||||
|
- "Command-Line"
|
||||||
|
- "Shell"
|
||||||
|
- "Command-Prompt"
|
||||||
|
- "PowerShell"
|
||||||
|
- "WSL"
|
||||||
|
- "Developer-Tools"
|
||||||
|
- "Utilities"
|
||||||
|
- "cli"
|
||||||
|
- "cmd"
|
||||||
|
- "ps"
|
||||||
|
- "terminal"
|
||||||
|
ManifestType: defaultLocale
|
||||||
|
ManifestVersion: 1.0.0
|
5
packages/winget/JanDeDobbeleer.OhMyPosh.yaml
Normal file
5
packages/winget/JanDeDobbeleer.OhMyPosh.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
PackageIdentifier: JanDeDobbeleer.OhMyPosh
|
||||||
|
PackageVersion: <VERSION>
|
||||||
|
DefaultLocale: en-US
|
||||||
|
ManifestType: version
|
||||||
|
ManifestVersion: 1.0.0
|
49
packages/winget/build.ps1
Normal file
49
packages/winget/build.ps1
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
Param
|
||||||
|
(
|
||||||
|
[parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$Version,
|
||||||
|
[parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$Hash,
|
||||||
|
[parameter(Mandatory = $false)]
|
||||||
|
[string]
|
||||||
|
$Token
|
||||||
|
)
|
||||||
|
|
||||||
|
function Set-Version {
|
||||||
|
param (
|
||||||
|
[parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$FileName,
|
||||||
|
[parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$Version,
|
||||||
|
[parameter(Mandatory = $true)]
|
||||||
|
[string]
|
||||||
|
$Hash
|
||||||
|
)
|
||||||
|
$content = Get-Content $FileName -Raw
|
||||||
|
$content = $content.Replace('<VERSION>', $Version)
|
||||||
|
$content = $content.Replace('<HASH>', $Hash)
|
||||||
|
$content | Out-File -Encoding 'UTF8' "./$Version/$FileName"
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -Path $PWD -Name $Version -ItemType "directory"
|
||||||
|
# Get all files inside the folder and adjust the version/hash
|
||||||
|
Get-ChildItem '*.yaml' | ForEach-Object -Process {
|
||||||
|
Set-Version -FileName $_.Name -Version $Version -Hash $hash
|
||||||
|
}
|
||||||
|
if (-not $Token) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
# Get the latest wingetcreate exe
|
||||||
|
# Replace with the following once https://github.com/microsoft/winget-create/issues/38 is resolved:
|
||||||
|
# Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
|
||||||
|
Invoke-WebRequest 'https://github.com/JanDeDobbeleer/winget-create/releases/latest/download/wingetcreate.zip' -OutFile wingetcreate.zip
|
||||||
|
Expand-Archive -LiteralPath wingetcreate.zip -DestinationPath wingetcreate
|
||||||
|
$wingetcreate = Resolve-Path -Path wingetcreate
|
||||||
|
$env:Path += ";$($wingetcreate.Path)"
|
||||||
|
# Create the PR
|
||||||
|
WingetCreateCLI.exe submit --token $Token $Version
|
Loading…
Reference in a new issue