Replaced -GitClone with -NoGitClone
This commit is contained in:
parent
ef920fbb7d
commit
c25de685c1
|
@ -3,7 +3,7 @@
|
||||||
[switch]$RemoveOnly,
|
[switch]$RemoveOnly,
|
||||||
[switch]$ShowSkipped,
|
[switch]$ShowSkipped,
|
||||||
[switch]$Force,
|
[switch]$Force,
|
||||||
[switch]$GitClone,
|
[switch]$NoGitClone,
|
||||||
[string]$GitURL = 'https://code.lksz.me/lksz/PowerShell_Scripts',
|
[string]$GitURL = 'https://code.lksz.me/lksz/PowerShell_Scripts',
|
||||||
[Parameter(DontShow)]
|
[Parameter(DontShow)]
|
||||||
[string]$MyPSScriptRoot = $MyPSScriptRoot
|
[string]$MyPSScriptRoot = $MyPSScriptRoot
|
||||||
|
@ -15,7 +15,7 @@ function _Setup {
|
||||||
[switch]$RemoveOnly,
|
[switch]$RemoveOnly,
|
||||||
[switch]$ShowSkipped,
|
[switch]$ShowSkipped,
|
||||||
[switch]$Force,
|
[switch]$Force,
|
||||||
[switch]$GitClone,
|
[switch]$NoGitClone,
|
||||||
[string]$GitURL = 'https://code.lksz.me/lksz/PowerShell_Scripts',
|
[string]$GitURL = 'https://code.lksz.me/lksz/PowerShell_Scripts',
|
||||||
[Parameter(DontShow)]
|
[Parameter(DontShow)]
|
||||||
[string]$MyPSScriptRoot = $MyPSScriptRoot)
|
[string]$MyPSScriptRoot = $MyPSScriptRoot)
|
||||||
|
@ -40,9 +40,9 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
|
||||||
## _Setup Logic starts here
|
## _Setup Logic starts here
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
if ( $GitClone -and -not (Test-Path $(Join-Path $MyPSScriptRoot '.git')) ) {
|
if ( -not $NoGitClone -and -not (Test-Path $(Join-Path $MyPSScriptRoot '.git')) ) {
|
||||||
if ( -not [bool]$(Get-Command git -ErrorAction SilentlyContinue) ) {
|
if ( -not [bool]$(Get-Command git -ErrorAction SilentlyContinue) ) {
|
||||||
throw "No git command found, you may either omit the -GitClone switch or install git and try again."
|
throw "No git command found, you may either omit run with the -NoGitClone switch or install git and try again."
|
||||||
}
|
}
|
||||||
if ( $PSCmdlet.ShouldProcess("Pull git repo from $GitURL into $MyPSScriptRoot ?") ) {
|
if ( $PSCmdlet.ShouldProcess("Pull git repo from $GitURL into $MyPSScriptRoot ?") ) {
|
||||||
Push-Location $MyPSScriptRoot
|
Push-Location $MyPSScriptRoot
|
||||||
|
@ -59,7 +59,7 @@ Get-Command Reload-MyScripts -ErrorAction SilentlyContinue | ForEach-Object { .
|
||||||
$GitOutput = "$(& git checkout --force)"
|
$GitOutput = "$(& git checkout --force)"
|
||||||
Write-Verbose $GitOutput
|
Write-Verbose $GitOutput
|
||||||
Pop-Location
|
Pop-Location
|
||||||
Write-Verbose "-GitClone step done."
|
Write-Verbose "Git clone done."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue