mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-12 14:07:20 +02:00
Improve the scripts
This commit is contained in:
@ -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])"
|
||||
|
Reference in New Issue
Block a user