mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-27 09:08:58 +01:00
Updated some scripts
This commit is contained in:
parent
3187d04df6
commit
142f14bb44
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./check-repo.ps1 C:\MyRepo
|
||||
⏳ (1/10) Searching for Git executable... git version 2.41.0.windows.3
|
||||
⏳ (2/10) Checking local repository... 📂C:\MyRepo
|
||||
⏳ (2/10) Checking local repository... C:\MyRepo
|
||||
⏳ (3/10) Querying remote URL... git@github.com:fleschutz/PowerShell.git
|
||||
⏳ (4/10) Querying current branch... main
|
||||
⏳ (5/10) Fetching remote updates... OK
|
||||
@ -33,7 +33,7 @@ try {
|
||||
Write-Host "⏳ (2/10) Checking local repository... " -noNewline
|
||||
$FullPath = Resolve-Path "$pathToRepo"
|
||||
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
|
||||
"📂$FullPath"
|
||||
"$FullPath"
|
||||
|
||||
Write-Host "⏳ (3/10) Querying remote URL... " -noNewline
|
||||
& git -C "$FullPath" remote get-url origin
|
||||
@ -71,7 +71,7 @@ try {
|
||||
|
||||
$repoDirName = (Get-Item "$FullPath").Name
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
"✔️ Checked repo 📂$repoDirName in $($elapsed)s."
|
||||
"✔️ Checked repository 📂$repoDirName in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./pull-repo.ps1
|
||||
⏳ (1/4) Searching for Git executable... git version 2.44.0.windows.1
|
||||
⏳ (2/4) Checking local repository... 📂C:\Repos\rust
|
||||
⏳ (2/4) Checking local repository... C:\Repos\rust
|
||||
⏳ (3/4) Pulling remote updates...
|
||||
⏳ (4/4) Updating submodules...
|
||||
✔️ Updates pulled into 📂rust repo in 14s.
|
||||
@ -27,7 +27,7 @@ try {
|
||||
& git --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
Write-Host "⏳ (2/4) Checking local repository... 📂$pathToRepo"
|
||||
Write-Host "⏳ (2/4) Checking local repository... $pathToRepo"
|
||||
if (-not(Test-Path "$pathToRepo" -pathType container)) { throw "Can't access folder: $pathToRepo" }
|
||||
$result = (git -C "$pathToRepo" status)
|
||||
if ("$result" -match "HEAD detached at ") { throw "Nothing to pull due to detached HEAD state (not on a branch!)" }
|
||||
|
@ -48,10 +48,10 @@ try {
|
||||
}
|
||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||
if ($failed -eq 0) {
|
||||
"✔️ Updated $numFolders repositories in 📂$parentDirName (took $($elapsed)s)."
|
||||
"✔️ Updated $numFolders repositories under 📂$parentDirName in $($elapsed)s."
|
||||
exit 0 # success
|
||||
} else {
|
||||
"⚠️ Updated $numFolders repositories in 📂$parentDirName but $failed failed (took $($elapsed)s)."
|
||||
"⚠️ Updated $numFolders repositories under 📂$parentDirName in $($elapsed)s but $failed failed!"
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user