Install posh theme automatically
This commit is contained in:
parent
a3c90aa1cf
commit
c908a45eeb
2 changed files with 42 additions and 8 deletions
|
@ -3,6 +3,7 @@ param (
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
@ -18,4 +19,30 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
||||
) -join [System.Environment]::NewLine)
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$theme = Get-UserConfig "oh-my-posh.theme";
|
||||
|
||||
if ($theme) {
|
||||
$varName = "POSH_THEME";
|
||||
|
||||
if ($theme -isnot [string]) {
|
||||
$root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh";
|
||||
$path = Join-Path $root "$($theme.name).omp.json";
|
||||
$null = New-Item -Force -ItemType Directory $root;
|
||||
Copy-Item $theme.source $path;
|
||||
$theme = [string] $path;
|
||||
}
|
||||
|
||||
if ($IsWindows) {
|
||||
[System.Environment]::SetEnvironmentVariable($varName, $path, "User");
|
||||
} else {
|
||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||
Add-EnvironmentVariable -User $Arguments.Name $varName $path;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,11 +6,18 @@ param (
|
|||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
||||
} `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1" `
|
||||
-Action ([InstallerAction]::Configure);
|
||||
};
|
||||
& {
|
||||
param($Parameters)
|
||||
$base = "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
||||
} `
|
||||
-Configurator {
|
||||
. $base -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
. $base -Action ([InstallerAction]::ConfigureUser);
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
|
Loading…
Reference in a new issue