mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-16 11:40:53 +01:00
Update switch-branch.ps1
This commit is contained in:
parent
3d1462f2f5
commit
69b9544a21
@ -19,6 +19,7 @@ param([string]$BranchName = "", [string]$RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
|
||||
if ($RepoDir -eq "") { $RepoDir = read-host "Enter path to the Git repository" }
|
||||
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
@ -52,7 +53,7 @@ try {
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ switched Git repository 📂$RepoDirName to $BranchName branch in $Elapsed sec"
|
||||
"✔️ switched Git repo 📂$RepoDirName to $BranchName branch in $Elapsed sec"
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||
|
Loading…
Reference in New Issue
Block a user