mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
Added fetch-repos.ps1
This commit is contained in:
parent
7adab1ccd3
commit
4bd0f442f2
@ -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
|
download.ps1, downloads the file/directory from the given URL
|
||||||
enable-crash-dumps.ps1, enables the writing of crash dumps
|
enable-crash-dumps.ps1, enables the writing of crash dumps
|
||||||
encrypt-file.ps1, encrypts the given file
|
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
|
generate-qrcode.ps1, generates a QR code
|
||||||
hibernate.ps1, enables hibernate mode for the local computer (requires admin rights)
|
hibernate.ps1, enables hibernate mode for the local computer (requires admin rights)
|
||||||
inspect-exe.ps1, prints basic information of the given executable file
|
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-test.ps1, performs a speak test by text-to-speech (TTS)
|
||||||
speak-text.ps1, speaks the given text 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)
|
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
|
switch-shelly1.ps1, switches a Shelly1 device in the local network
|
||||||
take-screenshot.ps1, takes a single screenshot
|
take-screenshot.ps1, takes a single screenshot
|
||||||
take-screenshots.ps1, takes multiple screenshots
|
take-screenshots.ps1, takes multiple screenshots
|
||||||
|
|
@ -53,7 +53,8 @@ Scripts for Git
|
|||||||
* [clean-branch.ps1](Scripts/clean-branch.ps1) - cleans the current Git branch (including submodules) from generated files
|
* [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
|
* [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
|
* [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
|
* [update-repos.ps1](Scripts/update-repos.ps1) - updates all Git repositories under the current/given directory
|
||||||
|
|
||||||
Scripts for Files & Folders
|
Scripts for Files & Folders
|
||||||
|
37
Scripts/fetch-repos.ps1
Executable file
37
Scripts/fetch-repos.ps1
Executable 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
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/powershell
|
#!/bin/powershell
|
||||||
<#
|
<#
|
||||||
.SYNTAX ./switch-branch.ps1 [<branch>]
|
.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
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
Loading…
Reference in New Issue
Block a user