Add scripts for configuring git
This commit is contained in:
parent
1f20af3bc5
commit
6b1aee97a6
3 changed files with 120 additions and 39 deletions
scripts/Windows/Software/git
|
@ -7,43 +7,18 @@ param (
|
|||
. "$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;
|
||||
}
|
||||
}
|
||||
$base = "$PSScriptRoot/../../../Common/Software/git/Manage.ps1";
|
||||
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
$params = "/WindowsTerminalProfile";
|
||||
$defaultBranch = Get-GitOption "defaultBranch";
|
||||
$defaultBranch = Get-Config "valhalla.git.defaultBranch";
|
||||
|
||||
if ($defaultBranch) {
|
||||
$params += " /DefaultBranchName:`"$defaultBranch`"";
|
||||
|
@ -52,8 +27,13 @@ $null = New-Module {
|
|||
Install-ChocoPackage git -ArgumentList "--params",$params;
|
||||
} `
|
||||
-Configurator {
|
||||
& "$PSScriptRoot/../../../Common/Software/git/Manage.ps1" @Parameters;
|
||||
};
|
||||
& $base ([InstallerAction]::Configure);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
$Arguments
|
||||
)
|
||||
|
||||
Export-ModuleMember -Function @();
|
||||
} -ArgumentList $PSBoundParameters
|
||||
& $base ([InstallerAction]::ConfigureUser) @PSBoundParameterrs;
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue