mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 05:04:39 +02:00
Updated the manuals
This commit is contained in:
@ -27,7 +27,7 @@ Example
|
||||
```powershell
|
||||
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.
|
||||
|
||||
```
|
||||
|
||||
@ -52,7 +52,7 @@ Script Content
|
||||
.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
|
||||
@ -64,17 +64,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-repositories.csv... " -noNewline
|
||||
$table = Import-CSV "$PSScriptRoot/../data/popular-repositories.csv"
|
||||
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
|
||||
@ -89,22 +89,22 @@ try {
|
||||
$step++
|
||||
|
||||
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
||||
"⏳ ($step/$($total + 4)) Skipping existing 📂$folderName (a $category)..."
|
||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName - the $category exists already..."
|
||||
$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])"
|
||||
@ -112,4 +112,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 05/19/2024 10:25:19)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 08/15/2024 09:50:46)*
|
||||
|
Reference in New Issue
Block a user