mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-12 08:58:16 +01:00
Improve output of switch-branch.ps1
This commit is contained in:
parent
1a2abfaf61
commit
6406e4360b
@ -9,6 +9,7 @@ param($BranchName = "", $RepoDir = "$PWD")
|
|||||||
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
|
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$RepoDir = resolve-path "$RepoDir"
|
||||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||||
set-location "$RepoDir"
|
set-location "$RepoDir"
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ try {
|
|||||||
& git pull --recurse-submodules
|
& git pull --recurse-submodules
|
||||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||||
|
|
||||||
"✔️switched Git repository 📂$RepoDir to branch 🌵$BranchName"
|
"✔️ switched Git repository 📂$RepoDir to branch 🌵$BranchName"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user