Updated cd-repo.ps1 and clean-repo.ps1

This commit is contained in:
Markus Fleschutz 2024-12-11 08:19:59 +01:00
parent 9063f34652
commit 1aca3e811a
2 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,8 @@
Specifies the folder name of the Git repository Specifies the folder name of the Git repository
.EXAMPLE .EXAMPLE
PS> ./cd-repo.ps1 rust PS> ./cd-repo.ps1 rust
📂C:\Repos\rust · on branch: ## main ... origin/main 📂C:\Repos\rust
🌿on branch: ## main ... origin/main
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -38,7 +39,7 @@ try {
$path = Resolve-Path "$path" $path = Resolve-Path "$path"
Set-Location "$path" Set-Location "$path"
Write-Host "📂$path · on branch: " -noNewline Write-Host "📂$path`n🌿on branch: " -noNewline
& git status --short --branch --show-stash & git status --short --branch --show-stash
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -12,7 +12,7 @@
(2/4) Checking local repository... C:\Repos\rust (2/4) Checking local repository... C:\Repos\rust
(3/4) Removing untracked files in repository... (3/4) Removing untracked files in repository...
(4/4) Removing untracked files in submodules... (4/4) Removing untracked files in submodules...
Repo 📂rust successfully cleaned up in 2s. Cleaned up repo 📂rust in 2s.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -45,7 +45,7 @@ try {
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds [int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"Repo 📂$repoName successfully cleaned up in $($elapsed)s." "Cleaned up repo 📂$repoName in $($elapsed)s."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"