Improve the scripts

This commit is contained in:
Markus Fleschutz 2021-04-18 10:55:37 +02:00
parent 139ceab42f
commit 41ccb7867b
9 changed files with 8 additions and 13 deletions

View File

@ -10,7 +10,6 @@ try {
$TargetDir = resolve-path "$HOME/Downloads/" $TargetDir = resolve-path "$HOME/Downloads/"
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,7 +10,6 @@ try {
$TargetDir = resolve-path "$HOME/" $TargetDir = resolve-path "$HOME/"
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,7 +10,6 @@ try {
$TargetDir = resolve-path "$HOME/Music/" $TargetDir = resolve-path "$HOME/Music/"
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,7 +10,6 @@ try {
$TargetDir = resolve-path "$HOME/Repos/" $TargetDir = resolve-path "$HOME/Repos/"
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -14,7 +14,6 @@ try {
} }
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -10,7 +10,6 @@ try {
$TargetDir = resolve-path "$PSScriptRoot/" $TargetDir = resolve-path "$PSScriptRoot/"
set-location "$TargetDir" set-location "$TargetDir"
"📂 $TargetDir" "📂 $TargetDir"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -19,7 +19,7 @@ write-host ""
# function prompt { "$ " } # result is: $ # function prompt { "$ " } # result is: $
function prompt { return "💲 " } # result is: 💲 function prompt { "`n💲 " } # result is: 💲
# My Alias Names (sorted alphabetically) # My Alias Names (sorted alphabetically)

View File

@ -1,7 +1,7 @@
#!/usr/bin/pwsh #!/usr/bin/pwsh
<# <#
.SYNTAX pull-repo.ps1 [<repo-dir>] .SYNTAX pull-repo.ps1 [<repo-dir>]
.DESCRIPTION pulls updates for the current/given Git repository (including submodules) .DESCRIPTION pulls updates a Git repository (including submodules)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
@ -14,13 +14,13 @@ try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
set-location "$RepoDir" set-location "$RepoDir"
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git pull --all --recurse-submodules --jobs=4 & git pull --all --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { throw "'git pull' failed" } if ($lastExitCode -ne "0") { throw "'git pull' failed" }
& git status "✔️ Git repository $RepoDir is up to date"
if ($lastExitCode -ne "0") { throw "'git status' failed" }
write-host -foregroundColor green "✔️ Updates pulled for Git repository $RepoDir"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -12,7 +12,8 @@ try {
copy-item "$PathToRepo/Scripts/my-profile.ps1" "$PathToProfile" -force copy-item "$PathToRepo/Scripts/my-profile.ps1" "$PathToProfile" -force
write-host -foregroundColor green "✔️ PowerShell profile 'CurrentUserCurrentHost' updated - gets active on next login" "✔️ PowerShell profile 'CurrentUserCurrentHost' updated by my-profile.ps1 - it gets active on next login"
""
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"