mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-12 22:17:17 +02:00
Updated the manuals
This commit is contained in:
@ -15,6 +15,7 @@ Parameters
|
||||
Position? 1
|
||||
Default value "$PWD"
|
||||
Accept pipeline input? false
|
||||
Aliases
|
||||
Accept wildcard characters? false
|
||||
|
||||
[<CommonParameters>]
|
||||
@ -26,7 +27,7 @@ Example
|
||||
-------
|
||||
```powershell
|
||||
PS> ./clean-repos.ps1 C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.40.1
|
||||
⏳ (1) Searching for Git executable... git version 2.47.1
|
||||
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
|
||||
⏳ (3/30) Cleaning 📂base256unicode...
|
||||
...
|
||||
@ -53,7 +54,7 @@ Script Content
|
||||
Specifies the path to the parent folder (current working dir by default)
|
||||
.EXAMPLE
|
||||
PS> ./clean-repos.ps1 C:\MyRepos
|
||||
⏳ (1) Searching for Git executable... git version 2.40.1
|
||||
⏳ (1) Searching for Git executable... git version 2.47.1
|
||||
⏳ (2) Checking parent folder 📂Repos... 28 subfolders found
|
||||
⏳ (3/30) Cleaning 📂base256unicode...
|
||||
...
|
||||
@ -70,7 +71,7 @@ try {
|
||||
|
||||
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" }
|
||||
if ($lastExitCode -ne 0) { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$parentDirName = (Get-Item "$ParentDir").Name
|
||||
Write-Host "⏳ (2) Checking parent folder 📂$parentDirName... " -noNewline
|
||||
@ -86,13 +87,13 @@ try {
|
||||
"⏳ ($Step/$($numFolders + 2)) Cleaning 📂$FolderName..."
|
||||
|
||||
& git -C "$folder" clean -xfd -f # force + recurse into dirs + don't use the standard ignore rules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
|
||||
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' failed with exit code $lastExitCode" }
|
||||
|
||||
& git -C "$folder" submodule foreach --recursive git clean -xfd -f
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
|
||||
if ($lastExitCode -ne 0) { throw "'git clean -xfd -f' in submodules failed with exit code $lastExitCode" }
|
||||
}
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✅ Cleaned $numFolders Git repos under 📂$parentDirName in $elapsed sec"
|
||||
"✅ Cleaned $numFolders Git repositories under 📂$parentDirName in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@ -100,4 +101,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(page generated by convert-ps2md.ps1 as of 01/23/2025 12:15:20)*
|
||||
*(page generated by convert-ps2md.ps1 as of 05/12/2025 22:02:53)*
|
||||
|
Reference in New Issue
Block a user