mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-09 21:07:40 +02:00
Updated the manuals
This commit is contained in:
@ -6,7 +6,7 @@ This PowerShell script clones popular Git repositories into a common target dire
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/clone-repos.ps1 [[-targetDir] <String>] [<CommonParameters>]
|
||||
|
||||
-targetDir <String>
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
@ -26,8 +26,11 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||
⏳ (3) Checking target folder... 📂Repos
|
||||
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
|
||||
...
|
||||
✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
|
||||
|
||||
```
|
||||
|
||||
@ -51,8 +54,11 @@ Script Content
|
||||
Specifies the file path to the target directory (current working directory by default)
|
||||
.EXAMPLE
|
||||
PS> ./clone-repos C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.46.0.windows.1
|
||||
⏳ (2) Reading data/popular-repos.csv... 29 repos
|
||||
⏳ (3) Checking target folder... 📂Repos
|
||||
⏳ (4/32) Cloning 📂base256 (dev tool) from git@github.com:fleschutz/talk2windows.git (shallow main branch)...
|
||||
...
|
||||
✔️ Cloned 29 additional Git repos into 📂MyRepos in 123s.
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -89,22 +95,22 @@ try {
|
||||
$step++
|
||||
|
||||
if (Test-Path "$targetDir/$folderName" -pathType container) {
|
||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName - the $category exists already..."
|
||||
"⏳ ($step/$($total + 3)) Skipping 📂$folderName ($category): exists already"
|
||||
$skipped++
|
||||
} elseif ($shallow -eq "yes") {
|
||||
"⏳ ($step/$($total + 3)) Cloning into 📂$folderName (a $category, $branch branch, shallow)..."
|
||||
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (shallow $branch branch)..."
|
||||
& 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 + 3)) Cloning into 📂$folderName (a $category, $branch branch, full history)..."
|
||||
"⏳ ($step/$($total + 3)) Cloning 📂$folderName ($category) from $URL (full $branch branch)..."
|
||||
& 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 additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||
"✅ Cloned $cloned additional Git repos into 📂$targetDirName in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -112,4 +118,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 08/15/2024 09:50:46)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of clone-repos.ps1 as of 11/08/2024 12:34:47)*
|
||||
|
Reference in New Issue
Block a user