From bbe8885cf562f20234706c1c4515822351640862 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 31 Jul 2024 19:51:14 +0200 Subject: [PATCH] Updated clone-repos.ps1 --- scripts/clone-repos.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/clone-repos.ps1 b/scripts/clone-repos.ps1 index 74176beb..56fef278 100755 --- a/scripts/clone-repos.ps1 +++ b/scripts/clone-repos.ps1 @@ -8,7 +8,7 @@ .EXAMPLE PS> ./clone-repos C:\MyRepos ... - βœ”οΈ Cloned 29 of 29 Git repos into πŸ“‚MyRepos in 123 sec + βœ”οΈ Cloned 29 additional Git repos into πŸ“‚MyRepos in 123s. .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -20,17 +20,17 @@ param([string]$targetDir = "$PWD") try { $stopWatch = [system.diagnostics.stopwatch]::startNew() - Write-Host "⏳ (1) Searching for Git executable... " -noNewline + Write-Host "⏳ (1) Searching for Git executable... " -noNewline & git --version if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } - Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline + Write-Host "⏳ (2) Reading data/popular-repos.csv... " -noNewline $table = Import-CSV "$PSScriptRoot/../data/popular-repos.csv" $total = $table.count Write-Host "$total repos" $targetDirName = (Get-Item "$targetDir").Name - Write-Host "⏳ (3) Checking target folder... πŸ“‚$targetDirName" + Write-Host "⏳ (3) Checking target folder... πŸ“‚$targetDirName" if (-not(Test-Path "$targetDir" -pathType container)) { throw "Can't access directory: $targetDir" } [int]$step = 3 @@ -45,22 +45,22 @@ try { $step++ if (Test-Path "$targetDir/$folderName" -pathType container) { - "⏳ ($step/$($total + 4)) Skipping existing πŸ“‚$folderName (a $category)..." + "⏳ ($step/$($total + 3)) Skipping existing $category πŸ“‚$folderName..." $skipped++ } elseif ($shallow -eq "yes") { - "⏳ ($step/$($total + 4)) Cloning into πŸ“‚$folderName (a $category, $branch branch, shallow)..." + "⏳ ($step/$($total + 3)) Cloning into πŸ“‚$folderName (a $category, $branch branch, shallow)..." & git clone --branch "$branch" --single-branch --recurse-submodules "$URL" "$targetDir/$folderName" if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" } $cloned++ } else { - "⏳ ($step/$($total + 4)) Cloning into πŸ“‚$folderName (a $category, $branch branch, full history)..." + "⏳ ($step/$($total + 3)) Cloning into πŸ“‚$folderName (a $category, $branch branch, full history)..." & git clone --branch "$branch" --recurse-submodules "$URL" "$targetDir/$folderName" if ($lastExitCode -ne "0") { throw "'git clone --branch $branch $URL' failed with exit code $lastExitCode" } $clone++ } } [int]$elapsed = $stopWatch.Elapsed.TotalSeconds - "βœ”οΈ Cloned $cloned of $total Git repos into πŸ“‚$targetDirName in $elapsed sec" + "βœ”οΈ Cloned $cloned additional Git repos into πŸ“‚$targetDirName in $($elapsed)s." exit 0 # success } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"