From b70257704209e85704c4ce925476e0db1d791e40 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 11 Mar 2025 12:47:30 +0100 Subject: [PATCH] Updated clean-repo.ps1 and switch-branch.ps1 --- scripts/clean-repo.ps1 | 7 ++----- scripts/switch-branch.ps1 | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/clean-repo.ps1 b/scripts/clean-repo.ps1 index 84b79c01..c4c7c6c2 100755 --- a/scripts/clean-repo.ps1 +++ b/scripts/clean-repo.ps1 @@ -12,7 +12,7 @@ ⏳ (2/4) Checking local repository... C:\Repos\rust ⏳ (3/4) Removing untracked files in repository... ⏳ (4/4) Removing untracked files in submodules... - βœ… Cleaned the πŸ“‚rust repository in 2s. + βœ… Repo πŸ“‚rust is clean now. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -22,8 +22,6 @@ param([string]$path = "$PWD") try { - $stopWatch = [system.diagnostics.stopwatch]::startNew() - Write-Host "⏳ (1/4) Searching for Git executable... " -noNewline & git --version if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" } @@ -44,8 +42,7 @@ try { & git -C "$path" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules if ($lastExitCode -ne 0) { throw "'git clean' in the submodules failed with exit code $lastExitCode" } - [int]$elapsed = $stopWatch.Elapsed.TotalSeconds - "βœ… Cleaned the πŸ“‚$repoName repository in $($elapsed)s." + "βœ… Repo πŸ“‚$repoName is clean now." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" diff --git a/scripts/switch-branch.ps1 b/scripts/switch-branch.ps1 index 7185c8fc..c6fb1cdf 100755 --- a/scripts/switch-branch.ps1 +++ b/scripts/switch-branch.ps1 @@ -15,7 +15,7 @@ ⏳ (4/6) Switching to branch 'main'... ⏳ (5/6) Pulling remote updates... ⏳ (6/6) Updating submodules... - βœ… Switched πŸ“‚rust repo to 'main' branch in 22s. + βœ… Repo πŸ“‚rust switched to 'main' branch in 22s. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -60,9 +60,9 @@ try { if ($lastExitCode -ne 0) { throw "'git submodule update' failed with exit code $lastExitCode" } [int]$elapsed = $stopWatch.Elapsed.TotalSeconds - "βœ… Switched πŸ“‚$repoDirName repo to '$branchName' branch in $($elapsed)s." + "βœ… Repo πŸ“‚$repoDirName switched to '$branchName' branch in $($elapsed)s." exit 0 # success } catch { "⚠️ Error: $($Error[0]) in script line $($_.InvocationInfo.ScriptLineNumber)" exit 1 -} \ No newline at end of file +}