Added fetch-repos.ps1

This commit is contained in:
Markus Fleschutz 2021-02-21 12:20:04 +01:00
parent 7adab1ccd3
commit 4bd0f442f2
4 changed files with 42 additions and 3 deletions

View File

@ -26,6 +26,7 @@ display-time.ps1, displays the current time for 10 seconds by default
download.ps1, downloads the file/directory from the given URL
enable-crash-dumps.ps1, enables the writing of crash dumps
encrypt-file.ps1, encrypts the given file
fetch-repos.ps1, fetches all Git repositories under the current/given directory
generate-qrcode.ps1, generates a QR code
hibernate.ps1, enables hibernate mode for the local computer (requires admin rights)
inspect-exe.ps1, prints basic information of the given executable file
@ -100,7 +101,7 @@ speak-joke.ps1, speaks the next joke by text-to-speech (TTS)
speak-test.ps1, performs a speak test by text-to-speech (TTS)
speak-text.ps1, speaks the given text by text-to-speech (TTS)
speak-time.ps1, speaks the current time by text-to-speech (TTS)
switch-branch.ps1, switches to the given Git branch
switch-branch.ps1, switches the current Git repository to the given branch
switch-shelly1.ps1, switches a Shelly1 device in the local network
take-screenshot.ps1, takes a single screenshot
take-screenshots.ps1, takes multiple screenshots

1 Script Description
26 download.ps1 downloads the file/directory from the given URL
27 enable-crash-dumps.ps1 enables the writing of crash dumps
28 encrypt-file.ps1 encrypts the given file
29 fetch-repos.ps1 fetches all Git repositories under the current/given directory
30 generate-qrcode.ps1 generates a QR code
31 hibernate.ps1 enables hibernate mode for the local computer (requires admin rights)
32 inspect-exe.ps1 prints basic information of the given executable file
101 speak-test.ps1 performs a speak test by text-to-speech (TTS)
102 speak-text.ps1 speaks the given text by text-to-speech (TTS)
103 speak-time.ps1 speaks the current time by text-to-speech (TTS)
104 switch-branch.ps1 switches to the given Git branch switches the current Git repository to the given branch
105 switch-shelly1.ps1 switches a Shelly1 device in the local network
106 take-screenshot.ps1 takes a single screenshot
107 take-screenshots.ps1 takes multiple screenshots

View File

@ -53,7 +53,8 @@ Scripts for Git
* [clean-branch.ps1](Scripts/clean-branch.ps1) - cleans the current Git branch (including submodules) from generated files
* [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories
* [configure-git.ps1](Scripts/configure-git.ps1) - sets up the Git user configuration
* [switch-branch.ps1](Scripts/switch-branch.ps1) - switches to the given Git branch
* [fetch-repos.ps1](Scripts/fetch-repos.ps1) - fetches all Git repositories under the current/given directory
* [switch-branch.ps1](Scripts/switch-branch.ps1) - switches the current Git repository to the given branch
* [update-repos.ps1](Scripts/update-repos.ps1) - updates all Git repositories under the current/given directory
Scripts for Files & Folders

37
Scripts/fetch-repos.ps1 Executable file
View File

@ -0,0 +1,37 @@
#!/bin/powershell
<#
.SYNTAX ./fetch-repos.ps1 [<directory>]
.DESCRIPTION fetches all Git repositories under the current/given directory
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Directory = "")
if ($Directory -eq "") {
$Directory = "$PWD"
}
try {
& git --version
} catch {
write-error "ERROR: can't execute 'git' - make sure Git is installed and available"
exit 1
}
try {
$Files = get-childItem -path $Directory
foreach ($File in $Files) {
if ($File.Mode -like "d*") {
$Filename = $File.Name
write-progress "Fetching $Filename ..."
set-location $Filename
& git fetch --recurse-submodules
set-location ..
}
}
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,7 +1,7 @@
#!/bin/powershell
<#
.SYNTAX ./switch-branch.ps1 [<branch>]
.DESCRIPTION switches to the given Git branch
.DESCRIPTION switches the current Git repository to the given branch
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>