Make zoxide installation cross platform

This commit is contained in:
Manuel Thalmann 2024-09-19 22:24:36 +02:00
parent 91e7b21f34
commit 15861af5d2
3 changed files with 45 additions and 21 deletions

View file

@ -0,0 +1,19 @@
param(
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
. "$PSScriptRoot/../PowerShell/Profile.ps1";
Start-SoftwareInstaller @PSBoundParameters `
-Configurator {
Add-PowerShellProfileStatement `
-System `
-Category "zoxide" `
-Script (
@(
"# zoxide",
(Get-ScriptInitializer "zoxide init powershell | Out-String")
) -join [System.Environment]::NewLine);
};

View file

@ -8,7 +8,7 @@ begin
source "$dir/../fish/profile.fish" source "$dir/../fish/profile.fish"
echo 'eval "$(zoxide init bash)"' | installBashProfile "zoxide" echo 'eval "$(zoxide init bash)"' | installBashProfile "zoxide"
echo "zoxide init fish | source" | installFishProfile "zoxide" echo "zoxide init fish | source" | installFishProfile "zoxide"
sudo pwsh -NoProfile "$dir/install.ps1" sudo -HE pwsh -NoProfile "$dir/Main.ps1" Configure
end end
runInstaller $argv runInstaller $argv

View file

@ -3,25 +3,30 @@ param(
[hashtable] $Arguments [hashtable] $Arguments
) )
. "$PSScriptRoot/../../../Common/Software/PowerShell/Profile.ps1"; & {
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; param(
[hashtable] $Parameters
)
Start-SoftwareInstaller @PSBoundParameters ` . "$PSScriptRoot/../../../Common/Software/PowerShell/Profile.ps1";
-Installer { . "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
param( . "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
[scriptblock] $Installer $base = "$PSScriptRoot/../../../Common/Software/zoxide/Main.ps1";
)
Install-ChocoPackage zoxide; Start-SoftwareInstaller @PSBoundParameters `
Install-WingetPackage junegunn.fzf; -Installer {
} ` param(
-Configurator { [scriptblock] $Installer
Add-PowerShellProfileStatement ` )
-System `
-Category "zoxide" ` Install-ChocoPackage zoxide;
-Script ( Install-WingetPackage junegunn.fzf;
@( } `
"# zoxide", -Configurator {
(Get-ScriptInitializer "zoxide init powershell | Out-String") param(
) -join [System.Environment]::NewLine); $Arguments
}; )
& $base ([InstallerAction]::ConfigureUser) @PSBoundParameters;
};
} $PSBoundParameters;