Add list-submodules.ps1

This commit is contained in:
Markus 2021-05-06 16:58:24 +02:00
parent 1bc034b829
commit 0d55bd2ceb
3 changed files with 26 additions and 0 deletions

View File

@ -117,6 +117,7 @@ list-recycle-bin.ps1, lists the content of the recycle bin folder
list-scripts.ps1, lists all PowerShell scripts in this repository
list-services.ps1, lists the services on the local computer
list-sql-tables.ps1, lists the SQL server tables
list-submodules.ps1, lists the submodules of the current/given Git repository
list-system-info.ps1, lists system information on the local computer
list-tags.ps1, lists all tags in the current/given Git repository
list-tasks.ps1, lists all Windows scheduler tasks

1 Script Description
117 list-scripts.ps1 lists all PowerShell scripts in this repository
118 list-services.ps1 lists the services on the local computer
119 list-sql-tables.ps1 lists the SQL server tables
120 list-submodules.ps1 lists the submodules of the current/given Git repository
121 list-system-info.ps1 lists system information on the local computer
122 list-tags.ps1 lists all tags in the current/given Git repository
123 list-tasks.ps1 lists all Windows scheduler tasks

View File

@ -152,6 +152,7 @@ Mega Collection of PowerShell Scripts
* [list-branches.ps1](Scripts/list-branches.ps1) - lists all branches in the current/given Git repository
* [list-commits.ps1](Scripts/list-commits.ps1) - lists all commits in the current/given Git repository
* [list-latest-tag.ps1](Scripts/list-latest-tag.ps1) - lists the latest tag on the current branch in a Git repository
* [list-submodules.ps1](Scripts/list-submodules.ps1) - lists the submodules of the current/given Git repository
* [list-tags.ps1](Scripts/list-tags.ps1) - lists all tags in the current/given Git repository
* [pull-repo.ps1](Scripts/pull-repo.ps1) - pulls updates for the current/given Git repository (including submodules)
* [pull-repos.ps1](Scripts/pull-repos.ps1) - pulls updates for all Git repositories under the current/given directory (including submodules)

View File

@ -0,0 +1,24 @@
<#
.SYNTAX list-submodules.ps1 [<repo-dir>]
.DESCRIPTION lists the submodules of the current/given Git repository
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($RepoDir = "$PWD")
try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir"
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git submodule
if ($lastExitCode -ne "0") { throw "'git submodule' failed" }
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}