Improve the scripts

This commit is contained in:
Markus Fleschutz
2021-04-18 10:55:37 +02:00
parent 139ceab42f
commit 41ccb7867b
9 changed files with 8 additions and 13 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/pwsh
<#
.SYNTAX pull-repo.ps1 [<repo-dir>]
.DESCRIPTION pulls updates for the current/given Git repository (including submodules)
.DESCRIPTION pulls updates a Git repository (including submodules)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
@ -14,13 +14,13 @@ try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git pull --all --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
& git status
if ($lastExitCode -ne "0") { throw "'git status' failed" }
write-host -foregroundColor green "✔️ Updates pulled for Git repository $RepoDir"
"✔️ Git repository $RepoDir is up to date"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"