PortValhalla/scripts/Windows/Software/git/Manage.ps1

60 lines
1.5 KiB
PowerShell
Raw Normal View History

2024-08-10 13:28:10 +00:00
param (
$Action,
[hashtable] $Arguments
)
. "$PSScriptRoot/../../../Common/Scripts/Config.ps1";
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
$null = New-Module {
param(
[hashtable] $Parameters
)
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
<#
.SYNOPSIS
Gets a configuration value related to git.
.PARAMETER Name
The name of the configuration to get.
.PARAMETER User
The name of the user to get the configuration for.
#>
function Get-GitOption {
param(
[Parameter(Mandatory)]
[string] $Name,
[string] $User
)
$config = "git.$Name";
if ($User) {
Get-UserConfig -UserName $User -Name $config;
} else {
Get-Config $config;
}
}
Start-SoftwareInstaller @Parameters `
-Installer {
$params = "/WindowsTerminalProfile";
$defaultBranch = Get-GitOption "defaultBranch";
if ($defaultBranch) {
$params += " /DefaultBranchName:`"$defaultBranch`"";
}
Install-ChocoPackage git -ArgumentList "--params",$params;
} `
-Configurator {
& "$PSScriptRoot/../../../Common/Software/git/Manage.ps1" @Parameters;
};
Export-ModuleMember -Function @();
} -ArgumentList $PSBoundParameters