mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-22 20:51:17 +01:00
Improve the output
This commit is contained in:
parent
e8df5794cd
commit
fd7b60182d
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Cleans all Git repositories in a folder from untracked files (including submodules)
|
||||
Cleans all Git repositories in a folder from untracked files
|
||||
.DESCRIPTION
|
||||
This script cleans all Git repositories in a folder from untracked files (including submodules).
|
||||
.PARAMETER ParentDir
|
||||
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./clean-repos C:\MyRepos
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -31,7 +31,7 @@ try {
|
||||
[int]$Step = 1
|
||||
foreach ($Folder in $Folders) {
|
||||
$FolderName = (get-item "$Folder").Name
|
||||
"⏳ Cleaning 📂$FolderName (step $Step/$($FolderCount))..."
|
||||
"⏳ Step $Step/$FolderCount: 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" }
|
||||
@ -41,7 +41,6 @@ try {
|
||||
|
||||
$Step++
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ cleaned $FolderCount Git repositories at 📂$ParentDirName in $Elapsed sec"
|
||||
exit 0 # success
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Fetches updates for all Git repositories in a folder (including submodules)
|
||||
Fetches updates for all Git repositories in a folder
|
||||
.DESCRIPTION
|
||||
This script fetches updates for all Git repositories in a folder (including submodules).
|
||||
.PARAMETER ParentDir
|
||||
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./fetch-repos C:\MyRepos
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -31,7 +31,7 @@ try {
|
||||
[int]$Step = 1
|
||||
foreach ($Folder in $Folders) {
|
||||
$FolderName = (get-item "$Folder").Name
|
||||
"⏳ Fetching 📂$FolderName... [step $Step/$NumFolders]"
|
||||
"⏳ Step $Step/$NumFolders: Fetching 📂$FolderName..."
|
||||
|
||||
& git -C "$Folder" fetch --all --recurse-submodules --prune --prune-tags --force
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' in $FolderName failed" }
|
||||
|
@ -17,16 +17,16 @@ try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if ($IsLinux) {
|
||||
"⏳ (1/4) Fetching update infos for installed Debian packages..."
|
||||
"⏳ Step 1/4: Fetching update infos for installed Debian packages..."
|
||||
& sudo apt update
|
||||
|
||||
"⏳ (2/4) Upgrading installed Debian packages..."
|
||||
"⏳ Step 2/4: Upgrading installed Debian packages..."
|
||||
& sudo apt upgrade --yes
|
||||
|
||||
"⏳ (3/4) Removing obsolete Debian packages..."
|
||||
"⏳ Step 3/4: Removing obsolete Debian packages..."
|
||||
& sudo apt autoremove --yes
|
||||
|
||||
"⏳ (4/4) Upgrading installed Snap packages..."
|
||||
"⏳ Step 4/4: Upgrading installed Snap packages..."
|
||||
& sudo snap refresh
|
||||
} else {
|
||||
"Sorry, not supported yet"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Pulls updates for a Git repository (including submodules)
|
||||
Pulls updates for a Git repository
|
||||
.DESCRIPTION
|
||||
This script pulls updates for a local Git repository (including submodules).
|
||||
.PARAMETER RepoDir
|
||||
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./pull-repo C:\MyRepo
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -18,7 +18,7 @@ param([string]$RepoDir = "$PWD")
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ (1/3) Checking requirements... "
|
||||
"⏳ Step 1/3: Checking requirements... "
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
@ -29,11 +29,11 @@ try {
|
||||
exit 0 # success
|
||||
}
|
||||
|
||||
"⏳ (2/3) Pulling updates... "
|
||||
"⏳ Step 2/3: Pulling updates... "
|
||||
& git pull --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
"⏳ (3/3) Updating submodules... "
|
||||
"⏳ Step 3/3: Updating submodules... "
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Pulls updates for all Git repositories in a folder (including submodules)
|
||||
Pulls updates for all Git repositories in a folder
|
||||
.DESCRIPTION
|
||||
This PowerShell script pulls updates for all Git repositories in a folder (including submodules).
|
||||
.PARAMETER ParentDir
|
||||
@ -8,7 +8,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./pull-repos C:\MyRepos
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -31,7 +31,7 @@ try {
|
||||
[int]$Step = 1
|
||||
foreach ($Folder in $Folders) {
|
||||
$FolderName = (get-item "$Folder").Name
|
||||
"⏳ ($Step/$NumFolders) Pulling 📂$FolderName... "
|
||||
"⏳ Step $Step/$NumFolders: Pulling 📂$FolderName... "
|
||||
|
||||
& git -C "$Folder" pull --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { write-warning "'git pull' in 📂$FolderName failed" }
|
||||
|
@ -6,7 +6,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./start-ipfs-server
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -14,16 +14,14 @@
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
""
|
||||
" ($Step/$NumFolders) Pulling 📂$FolderName... "
|
||||
"⏳ (1/5) Searching for IPFS executable..."
|
||||
"⏳ Step 1/5: Searching for IPFS executable..."
|
||||
& ipfs --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
|
||||
""
|
||||
"⏳ (2/5) Initializing IPFS with server profile..."
|
||||
"⏳ Step 2/5: Initializing IPFS with server profile..."
|
||||
& ipfs init --profile server
|
||||
|
||||
"⏳ (3/5) Configuring IPFS..."
|
||||
"⏳ Step 3/5: Configuring IPFS..."
|
||||
& ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
||||
if ($lastExitCode -ne "0") { throw "'ipfs config Addresses.API' failed" }
|
||||
|
||||
@ -37,11 +35,11 @@ try {
|
||||
& ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"POST\"]'
|
||||
if ($lastExitCode -ne "0") { throw "'ipfs config Access-Control-Allow-Methods' failed" }
|
||||
""
|
||||
"⏳ (4/5) Increasing UDP receive buffer size..."
|
||||
"⏳ Step 4/5: Increasing UDP receive buffer size..."
|
||||
& sudo sysctl -w net.core.rmem_max=2500000
|
||||
if ($lastExitCode -ne "0") { throw "'sysctl' failed" }
|
||||
""
|
||||
"⏳ (5/5) Starting IPFS daemon..."
|
||||
"⏳ Step 5/5: Starting IPFS daemon..."
|
||||
# Start-Process nohup 'ipfs daemon'
|
||||
Start-Process nohup -ArgumentList 'ipfs','daemon' -RedirectStandardOutput "$HOME/console.out" -RedirectStandardError "$HOME/console.err"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Switches the branch in a Git repository (including submodules)
|
||||
Switches the branch in a Git repository
|
||||
.DESCRIPTION
|
||||
This script switches to another branch in a Git repository (including submodules).
|
||||
.PARAMETER BranchName
|
||||
@ -10,7 +10,7 @@
|
||||
.EXAMPLE
|
||||
PS> ./switch-branch main C:\MyRepo
|
||||
.NOTES
|
||||
Author: Markus Fleschutz · License: CC0
|
||||
Author: Markus Fleschutz / License: CC0
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
#>
|
||||
@ -22,7 +22,7 @@ try {
|
||||
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
"⏳ (1/5) Checking requirements... "
|
||||
"⏳ Step 1/5: Checking requirements... "
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
@ -34,19 +34,19 @@ try {
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Git repository is NOT clean: $Result" }
|
||||
|
||||
"⏳ (2/5) Fetching latest updates..."
|
||||
"⏳ Step 2/5: Fetching latest updates..."
|
||||
& git fetch --all --recurse-submodules --prune --prune-tags --force
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
"⏳ (3/5) Switching branch..."
|
||||
"⏳ Step 3/5: Switching branch..."
|
||||
& git checkout --recurse-submodules "$BranchName"
|
||||
if ($lastExitCode -ne "0") { throw "'git checkout $BranchName' failed" }
|
||||
|
||||
"⏳ (4/5) Pulling updates..."
|
||||
"⏳ Step 4/5: Pulling updates..."
|
||||
& git pull --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
"⏳ (5/5) Updating submodules..."
|
||||
"⏳ Step 5/5: Updating submodules..."
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user