Lib/git_init_env.psm1
<#
.SYNOPSIS Initialize Git Environment .DESCRIPTION Initialize Git Environment. Preparation script for downloading the NAF repo. Includes all git related software for cloning. .NOTES Author : hillesheim@n-dimensions.de Version : 2.5 DateLastChanged : 2023-09-22 #> # Import-Module .\git_helper.psm1; Write-Host "Load module 'git_init_env' ... "; #region begin DECLARATION #region begin TYPES #endregion #region begin USER_VARIABLES #endregion #region begin SYSTEM_VARIABLES [String] $psScriptFilePath = $MyInvocation.MyCommand.Definition; [String] $psScriptFolderPath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent; #endregion #endregion #region begin FUNCTIONS Function Initialize-GitEnv { # Select job $enumJobSteps_InitGitEnv = "JobSteps_InitGitEnv" -as [System.Type]; [JobSteps_InitGitEnv[]] $selection = ` Enter-Selection ` -Enum $enumJobSteps_InitGitEnv ` -Default $defaultJobSteps_InitGitEnv ` -Title "Job Steps: Please Select" Write-Host ("Selected job steps: "); $selection ` | ForEach-Object { Write-Host ("- {0}" -f $_); } # Edit script If ($selection -contains [JobSteps_InitGitEnv]::OpenScriptEditor) { Open-ScriptEditor ` -Filepath $psScriptFilePath } # Install choco, allow global confirmation If ($selection -contains [JobSteps_InitGitEnv]::InstallChoco) { Write-Host ("- Install choco, allow global confirmation ... " ); [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) choco feature enable -n allowGlobalConfirmation; } # Install git If ($selection -contains [JobSteps_InitGitEnv]::InstallGit) { Write-Host ("- Install git ... " ); choco install git; } # Install github desktop If ($selection -contains [JobSteps_InitGitEnv]::InstallGithubDesktop) { Write-Host ("- Install github desktop ... " ); choco install github-desktop; } # Install github client If ($selection -contains [JobSteps_InitGitEnv]::InstallGithubClient) { Write-Host ("- Install github client ... " ); choco install gh; } # Install PowerShell 7 If ($selection -contains [JobSteps_InitGitEnv]::InstallPowerShell7) { Write-Host ( "- Install 'PowerShell 7' ... " ); choco install powershell-core; } # Restart If ($selection -contains [JobSteps_InitGitEnv]::Restart) { Write-Host ("- Restart ... " ); Restart-Computer -Force; } # Abort If($selection -contains [JobSteps_InitGitEnv]::Abort) { Return; } # Run another job $userInput = Read-Host("Run another job (y|n)? Press ENTER for 'y'"); If("" -eq $userInput ){ Initialize-GitEnv; } } #endregion |