chore(style): convert blocks into functions (see #325)
authorMarcin Woźniak <y0rune@aol.com>
Mon, 15 Nov 2021 20:33:22 +0000 (21:33 +0100)
committerAJ ONeal <aj@therootcompany.com>
Sun, 21 Nov 2021 10:50:03 +0000 (10:50 +0000)
61 files changed:
_webi/example_install_safe_copy.sh
arc/install.sh
archiver/install.sh
awless/install.sh
bat/install.sh
caddy/install.sh
chromedriver/install.sh
comrak/install.sh
curlie/install.sh
deno/install.sh
dotenv-linter/install.sh
fd/install.sh
ffmpeg/install.sh
flutter/install.sh
fzf/install.sh
git-config-gpg/git-config-gpg.sh
gitea/install.sh
gnupg/install.sh
go/install.sh
golang/install.sh
goreleaser/install.sh
gprox/install.sh
hexyl/install.sh
hugo/install.sh
iterm-utils/install.sh
iterm/install.sh
jq/install.sh
k9s/install.sh
kind/install.sh
kubectx/install.sh
kubens/install.sh
lsd/install.sh
myip/install.sh
nerd-font/install.sh
nerd-fonts/install.sh
nerdfont/install.sh
nerdfonts/install.sh
node/install.sh
pandoc/install.sh
pathman/install.sh
postgres/install.sh
postgresql/install.sh
powershell/install.sh
prettier/install.sh
pwsh/install.sh
rg/install.sh
ripgrep/install.sh
rust/install.sh
sd/install.sh
shfmt/install.sh
ssh-utils/install.sh
ssh-utils/ssh-setpass.sh
sudo/install.sh
vim-beyondcode/install.sh
vim-essentials/install.sh
vps-addswap/install.sh
vps-utils/install.sh
watchexec/install.sh
xz/install.sh
yq/install.sh
zoxide/install.sh

index e1600bb5822d1ead28eb31851681aebb3a9fbd62..32ac3e0c42216608f6e6daeb16b1b96d8f8bda7b 100644 (file)
@@ -1,5 +1,6 @@
+#!/bin/bash
 # For installing from the extracted package tmp directory
-pkg_install() {
+function pkg_install() {
     pushd "$WEBI_TMP" 2>&1 > /dev/null
 
     if [ -n "$(command -v rsync 2> /dev/null | grep rsync)" ]; then
index 4d983ee34fcd1c19a6463c8f5bd4e0a15585d341..184c05c0bb8e6fb6ceec887b205685f90e84189d 100644 (file)
@@ -1,4 +1,5 @@
-{
+#!/bin/bash
+function __init_arc() {
     set -e
     set -u
 
@@ -34,3 +35,5 @@
         echo "$(arc version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')"
     }
 }
+
+__init_arc
index e5a5e7218997ad7fdd17b298cd00b8853dec54a9..a817bf1bab815413c69aa9145b361f8f26ceb0a7 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: Archiver (arc alias)
 # homepage: https://webinstall.dev/arc
 # tagline: Alias for https://webinstall.dev/arc
index 089e2c4e62bac23722c75217afc558a139dfc163..db394c0bbd0f81b2e059840627de5242a168088b 100644 (file)
@@ -14,7 +14,7 @@ pkg_cmd_name="awless"
 # IMPORTANT: this let's other functions know to expect this to be a single file
 WEBI_SINGLE=true
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'awless version' has output in this format:
     #       v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
     # This trims it down to just the version number:
@@ -22,7 +22,7 @@ pkg_get_current_version() {
     echo "$(awless version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
 }
 
-pkg_install() {
+function pkg_install() {
     # $HOME/.local/opt/awless-v2.1.0/bin
     mkdir -p "$pkg_src_bin"
 
@@ -33,7 +33,7 @@ pkg_install() {
     chmod a+x "$pkg_src_cmd"
 }
 
-pkg_link() {
+function pkg_link() {
     # rm -f "$HOME/.local/bin/awless"
     rm -f "$pkg_dst_cmd"
 
index b6f812eae54acd528cc0d82a6a22fadf3ed68b17..004dea2c088190d668a5cb5895c885bb76ff6969 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_bat() {
     set -e
     set -u
 
@@ -29,3 +29,5 @@
         chmod a+x "$pkg_src_cmd"
     }
 }
+
+__init_bat
index c0980b99e45e287858b39db0f5bbbeaa87e2c819..f59c42a1fb410d03000f305a8de9cca0de1d7b17 100644 (file)
@@ -14,7 +14,7 @@ pkg_cmd_name="caddy"
 # IMPORTANT: this let's other functions know to expect this to be a single file
 WEBI_SINGLE=true
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'caddy version' has output in this format:
     #       v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
     # This trims it down to just the version number:
@@ -22,7 +22,7 @@ pkg_get_current_version() {
     echo "$(caddy version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
 }
 
-pkg_install() {
+function pkg_install() {
     # $HOME/.local/opt/caddy-v2.1.0/bin
     mkdir -p "$pkg_src_bin"
 
@@ -33,7 +33,7 @@ pkg_install() {
     chmod a+x "$pkg_src_cmd"
 }
 
-pkg_link() {
+function pkg_link() {
     # rm -f "$HOME/.local/bin/caddy"
     rm -f "$pkg_dst_cmd"
 
index b7e4bbf37901370d3489857c12f08b3670daef35..29c8ec92fb9b40fbe1f0f7fb8fc26c58abb0cc00 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_chromedriver() {
     set -e
     set -u
 
@@ -37,3 +37,5 @@
     }
 
 }
+
+__init_chromedriver
index a51a902e9eafbe202b226cd6f473e0e3ad5213e9..4e2bfb67e864f730c444459139b17ff0a6831a78 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_comrak() {
     set -e
     set -u
 
@@ -34,3 +34,5 @@
         "$pkg_src_cmd" --version > /dev/null
     }
 }
+
+__init_comrak
index f22adbdccf5292371fbdaaec5a14fd6e0360d3c1..b5ccebf869440c176a8771847ede57c16fd95daf 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_curlie() {
     set -e
     set -u
 
@@ -31,3 +31,5 @@
         chmod a+x "$pkg_src_cmd"
     }
 }
+
+__init_curlie
index 78fc3d57ef7b706854ce9819c078ce001caa8bfe..ff70f454d7973d942cb5fe01e9eebe24b2712e0c 100644 (file)
@@ -12,7 +12,7 @@ pkg_cmd_name="deno"
 # IMPORTANT: this let's other functions know to expect this to be a single file
 WEBI_SINGLE=true
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'deno --version' has output in this format:
     #       deno 1.1.0
     #       v8 8.4.300
@@ -22,7 +22,7 @@ pkg_get_current_version() {
     echo "$(deno --version 2> /dev/null | head -n 1 | cut -d' ' -f2)"
 }
 
-pkg_install() {
+function pkg_install() {
     # $HOME/.local/xbin
     mkdir -p "$pkg_src_bin"
 
@@ -33,7 +33,7 @@ pkg_install() {
     chmod a+x "$pkg_src_cmd"
 }
 
-pkg_link() {
+function pkg_link() {
     # rm -f "$HOME/.local/bin/deno"
     rm -f "$pkg_dst_cmd"
 
index 8a8c2ad529d58df958ee371f39d9eed302f888d7..2cbf3a184be559bba567c274c1fa39b8dfe6c8b7 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __dotenv_linter() {
     set -e
     set -u
 
@@ -37,3 +37,5 @@
     }
 
 }
+
+__dotenv_linter
index 50af4761cb6edbacc3c79711db8960f6ab4cc49e..58c7568631559dc86d1a4988f3d1addac8f88f58 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_fd() {
     set -e
     set -u
 
@@ -29,3 +29,5 @@
         chmod a+x "$pkg_src_cmd"
     }
 }
+
+__init_fd
index eaf4e30429f9bb55676414b071c1d64d0d1117d9..9eddc541992c0d2ed4a13494e10d55ccb74d99a8 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_ffmpeg() {
     set -e
     set -u
 
@@ -39,3 +39,5 @@
     }
 
 }
+
+__init_ffmpeg
index 9626eb36f987a62f0f91707adc9338ac44a1f28d..36ab4e1c00f175a675cab1ce1b10bd652451bd68 100644 (file)
@@ -21,7 +21,7 @@ pkg_src_cmd="$HOME/.local/opt/flutter-v$WEBI_VERSION/bin/flutter"
 pkg_src_dir="$HOME/.local/opt/flutter-v$WEBI_VERSION"
 pkg_src="$pkg_src_dir"
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'flutter --version' outputs a lot of information:
     #       Flutter 1.19.0-4.1.pre • channel beta • https://github.com/flutter/flutter.git
     #       Framework • revision f994b76974 (4 days ago) • 2020-06-09 15:53:13 -0700
@@ -32,7 +32,7 @@ pkg_get_current_version() {
     echo "$(flutter --version 2> /dev/null | head -n 1 | cut -d' ' -f2)"
 }
 
-pkg_format_cmd_version() {
+function pkg_format_cmd_version() {
     # 'flutter 1.19.0' is the canonical version format for flutter
     my_version="$1"
     echo "$pkg_cmd_name $my_version"
index 6c2145e3fd0a108f9601741c68451c0002d0cf82..7729455d982c11c5fce022c288d3e7ffafb6bad2 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_fzf() {
     set -e
     set -u
 
@@ -29,3 +29,5 @@
         chmod a+x "$pkg_src_cmd"
     }
 }
+
+__init_fzf
index 3b38745bb01c789085887e7c6f111cc20241d1d6..324bd000a8521da74a917306f3e6744f0427853b 100644 (file)
@@ -2,35 +2,39 @@
 set -e
 set -u
 
-export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
-export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
+function __git_gpg_init() {
+    export PATH="$HOME/.local/opt/gnupg/bin:$PATH"
+    export PATH="$HOME/.local/opt/gnupg/bin/pinentry-mac.app/Contents/MacOS:$PATH"
 
-# TODO check for public key without gpg-pubkey?
-if ! command -v gpg-pubkey; then
-    webi gpg-pubkey
-else
-    gpg-pubkey
-fi
+    # TODO check for public key without gpg-pubkey?
+    if ! command -v gpg-pubkey; then
+        webi gpg-pubkey
+    else
+        gpg-pubkey
+    fi
 
-MY_KEY_ID="$(
-    gpg-pubkey-id
-)"
+    MY_KEY_ID="$(
+        gpg-pubkey-id
+    )"
 
-echo -n "Enabling automatic git commit signing...
-    git config --global user.signingkey ${MY_KEY_ID}
+    echo -n "Enabling automatic git commit signing...
+           git config --global user.signingkey ${MY_KEY_ID}
+           git config --global commit.gpgsign true
+           git config --global log.showSignature true
+       "
+
+    git config --global user.signingkey "${MY_KEY_ID}"
     git config --global commit.gpgsign true
     git config --global log.showSignature true
-"
 
-git config --global user.signingkey "${MY_KEY_ID}"
-git config --global commit.gpgsign true
-git config --global log.showSignature true
+    echo ""
+    echo "Successfully updated ~/.gitconfig"
+    echo ""
+    echo "How to verify signed commits on GitHub:"
+    echo ""
+    echo "    1. Go to 'Add GPG Key': https://github.com/settings/gpg/new"
+    echo "    2. Copy and paste the key above from the first ---- to the last ----"
+    echo ""
+}
 
-echo ""
-echo "Successfully updated ~/.gitconfig"
-echo ""
-echo "How to verify signed commits on GitHub:"
-echo ""
-echo "    1. Go to 'Add GPG Key': https://github.com/settings/gpg/new"
-echo "    2. Copy and paste the key above from the first ---- to the last ----"
-echo ""
+__git_gpg_init
index bb55c660fdb6cf7afd36ebff139d2e4201cd9be9..5726292945fdc4b0f16ed4da0515567de4978974 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 set -e
 set -u
 
@@ -5,7 +6,7 @@ pkg_cmd_name="gitea"
 pkg_src_cmd="$HOME/.local/opt/gitea-v$WEBI_VERSION/gitea"
 pkg_dst_cmd="$HOME/.local/opt/gitea/gitea"
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'gitea version' has output in this format:
     #       v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
     # This trims it down to just the version number:
@@ -13,7 +14,7 @@ pkg_get_current_version() {
     echo "$(gitea --version 2> /dev/null | head -n 1 | cut -d' ' -f3)"
 }
 
-pkg_link() {
+function pkg_link() {
     # although gitea is a single command it must be put in its own directory
     # because it will always resolve its working path to its location,
     # regardless of where it was started, where its config file lives, etc.
@@ -24,7 +25,7 @@ pkg_link() {
 }
 
 # For installing from the extracted package tmp directory
-pkg_install() {
+function pkg_install() {
     # remove the versioned folder, just in case it's there with junk
     rm -rf "$pkg_src_bin"
     mkdir -p "$pkg_src_bin"
index 8f4595b9d0286fac1fee3a9afb9eb6500af23eb8..1d731da66d9892af7357effa3f0d7602c2ca8e17 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: GnuPG (gpg alias)
 # homepage: https://webinstall.dev/gpg
 # tagline: Alias for https://webinstall.dev/gpg
index 613fde2edcfef5c8a5a260facf1838c39e6dd961..c096eeaf21e3723591b41baee3b60135c09471a1 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: Go (golang alias)
 # homepage: https://webinstall.dev/golang
 # tagline: Alias for https://webinstall.dev/golang
index 4530dfa063a52f8472cf3a2372a3e1e850f7d853..2df6a91274c2b4a218b0822a6458039dc0d8e882 100644 (file)
@@ -15,7 +15,7 @@ pkg_cmd_name="go"
 #
 # Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'go version' has output in this format:
     #       go version go1.14.2 darwin/amd64
     # This trims it down to just the version number:
@@ -26,13 +26,13 @@ pkg_get_current_version() {
         sed 's:go::'
 }
 
-pkg_format_cmd_version() {
+function pkg_format_cmd_version() {
     # 'go v1.14.0' will be 'go1.14'
     my_version=$(echo "$1" | sed 's:\.0::g')
     echo "${pkg_cmd_name}${my_version}"
 }
 
-pkg_link() {
+function pkg_link() {
     # 'pkg_dst' will default to $HOME/.local/opt/go
     # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/go-v1.14.2
     rm -rf "$pkg_dst"
@@ -47,7 +47,7 @@ pkg_link() {
     ln -s "$GOBIN_REAL" "$GOBIN"
 }
 
-pkg_post_install() {
+function pkg_post_install() {
     pkg_link
 
     # web_path_add is defined in _webi/template.sh at https://github.com/webinstall/packages
@@ -108,7 +108,7 @@ pkg_post_install() {
     echo ""
 }
 
-pkg_done_message() {
+function pkg_done_message() {
     echo "Installed 'go v$WEBI_VERSION' to ~/.local/opt/go"
     # note: literal $HOME on purpose
     #shellcheck disable=SC2016
index 92eb6c904104d1dbb259c5e3f51ba3ba96670d4f..477035ca57b7abace5f33c60e5d811fdb8aadac9 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_goreleaser() {
     set -e
     set -u
 
@@ -37,3 +37,5 @@
     }
 
 }
+
+__init_goreleaser
index fdb7d420a9cdd858537d0999f790b258c3d3a2f7..103216541fb38e890c78eb459d43d2542239e0b1 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_gprox() {
     set -e
     set -u
 
@@ -27,3 +27,5 @@
         echo $(gprox --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
     }
 }
+
+__init_gprox
index 218c0e3e17896f942be61805c34d0aa420995ef8..74e24364a522ac8bf9c86ba1570ded9a478dc5a8 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_hexyl() {
     set -e
     set -u
 
@@ -29,3 +29,5 @@
         chmod a+x "$pkg_src_cmd"
     }
 }
+
+__init_hexyl
index fce62f4bd579d6525ca4b237c85016e5066b5579..1ef628415715a02e35a7715a8264e955c66f8420 100644 (file)
@@ -1,10 +1,11 @@
+#!/bin/bash
 set -e
 set -u
 
 pkg_cmd_name="hugo"
 WEBI_SINGLE=true
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'hugo version' has output in this format:
     #       Hugo Static Site Generator v0.72.0-8A7EF3CF darwin/amd64 BuildDate: 2020-05-31T12:07:44Z
     # This trims it down to just the version number:
index 7ade9a597888d108b822c0275582675e325285e2..b69437e652895fd8b1e6139e004c3b41eccb3f72 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: iterm-utils (iterm2-utils alias)
 # homepage: https://webinstall.dev/iterm2-utils
 # tagline: Alias for https://webinstall.dev/iterm2-utils
index 16716097db4cfb06bc4b4c3a1fdddb27bf63ff11..cc5e930f0e3d25b280abd5c2687228bad999eeea 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: iTerm (iTerm2 alias)
 # homepage: https://webinstall.dev/iterm2
 # tagline: Alias for https://webinstall.dev/iterm2
index a15919db85370110cd548eb44b430abd582ae7f5..205ea1bb3956ff44fbf56ed276a998278e39d4b9 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_jq() {
     set -e
     set -u
 
@@ -18,3 +18,5 @@
         echo $(jq --version 2> /dev/null | head -n 1 | sed 's:^jq-::')
     }
 }
+
+__init_jq
index f027ea1904bf1ebbc373725579aa9f3cbb040653..158316cc8b6269f086c655e0bf2ee7b79ee3284a 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_k9s() {
     set -e
     set -u
 
@@ -41,3 +41,5 @@
     }
 
 }
+
+__init_k9s
index 61a3181c9be8e8256c3ccec9d59fd16820fa8f7d..b3e1ed74ac71bf2bfb91f2c1b12d3af59a3ba5ab 100644 (file)
@@ -23,7 +23,7 @@ function __init_kind() {
     }
 
     pkg_get_current_version() {
-        echo $(kind --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
+        echo $(kind --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
     }
 
 }
index 17b34b8b1c572d9bc3038f50bd721e3c17850515..035a781651aad2b8e2cd1a58c6ab5da7b2c80749 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_kubectx() {
     set -e
     set -u
 
@@ -34,3 +34,5 @@
     }
 
 }
+
+__init_kubectx
index b4cdb1518c621ba87f559bb239f342128be0f673..aff1465f7069d17c41db63148a88a5723e4cb1a0 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_kubens() {
     set -e
     set -u
 
@@ -34,3 +34,5 @@
     }
 
 }
+
+__init_kubens
index 67d5876b428c50802d442cf8ffab726f44699e6d..ee91a4ea8b2a2dd70eac98325f4d0ff20eb08ff3 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_lsd() {
     set -e
     set -u
 
@@ -37,3 +37,5 @@
     }
 
 }
+
+__init_lsd
index 0d261e5eaa149897f90b78a9b7c03ddb5a8d20a6..2f908b561dd341d1a5861eedf8454447dc83243d 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_myip() {
     set -e
     set -u
 
@@ -10,3 +10,5 @@
 
     "$HOME/.local/bin/myip"
 }
+
+__init_myip
index e2af4475d7238ac5ab055e2731868e9cfcb162c3..b403cda6b4203a897948b66b1141ab8fdbc6d02d 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: nerd-font (nerdfont alias)
 # homepage: https://webinstall.dev/nerdfont
 # tagline: Alias for https://webinstall.dev/nerdfont
index bc37cfbd26f4bd29b6691da50dfd66a977ced1cf..fe4f2211f3018e4117e8d2bfa3cc3faf03bb3661 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: nerd-fonts (nerdfont alias)
 # homepage: https://webinstall.dev/nerdfont
 # tagline: Alias for https://webinstall.dev/nerdfont
index 179d5c060ca1c184bd5a44014b8296cf3691ae8e..5a43965125c0e222c6517e9a2790ef8864bddb29 100644 (file)
@@ -1,4 +1,6 @@
-install() {
+#!/bin/bash
+
+function __init_nerdfont() {
     set -e
     set -u
 
@@ -21,4 +23,4 @@ install() {
     echo "Installed $my_nerdfont to ~/$my_fontdir"
 }
 
-install
+__init_nerdfont
index bc37cfbd26f4bd29b6691da50dfd66a977ced1cf..fe4f2211f3018e4117e8d2bfa3cc3faf03bb3661 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: nerd-fonts (nerdfont alias)
 # homepage: https://webinstall.dev/nerdfont
 # tagline: Alias for https://webinstall.dev/nerdfont
index b0f822a38ab988abaea34d6a6e2c4a7f311b61e2..f321ab568d78e2f0cfba65ef20a18a1194b85ef7 100644 (file)
@@ -12,7 +12,7 @@ set -u
 pkg_cmd_name="node"
 #WEBI_SINGLE=""
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'node --version' has output in this format:
     #       v12.8.0
     # This trims it down to just the version number:
@@ -23,7 +23,7 @@ pkg_get_current_version() {
         sed 's:^v::'
 }
 
-pkg_install() {
+function pkg_install() {
     # mkdir -p $HOME/.local/opt
     mkdir -p "$(dirname $pkg_src)"
 
@@ -31,7 +31,7 @@ pkg_install() {
     mv ./"$pkg_cmd_name"* "$pkg_src"
 }
 
-pkg_link() {
+function pkg_link() {
     # rm -f "$HOME/.local/opt/node"
     rm -f "$pkg_dst"
 
@@ -42,6 +42,6 @@ pkg_link() {
     "$pkg_src"/bin/node "$pkg_src"/bin/npm config set scripts-prepend-node-path=true
 }
 
-pkg_done_message() {
+function pkg_done_message() {
     echo "Installed 'node' and 'npm' at $pkg_dst"
 }
index 5141a0fc10b9c16921fdbb2faccca3dbd5a34746..18e9625ab18014817637a72ca65ff3b742f0bb84 100644 (file)
@@ -1,4 +1,5 @@
-{
+#!/bin/bash
+function __init_pandoc{
     set -e
     set -u
 
@@ -41,3 +42,5 @@
         echo $(pandoc --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2)
     }
 }
+
+__init_pandoc
index 0d93ef55750731596f17e52d028eff33d4b0d2ef..a720f76416de1de1a57b904816a0a4c197815704 100644 (file)
@@ -6,11 +6,11 @@ set -u
 pkg_cmd_name="pathman"
 WEBI_SINGLE=true
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     echo $(pathman version 2> /dev/null | head -n 1 | cut -d ' ' -f2 | sed 's:^v::')
 }
 
-pkg_done_message() {
+function pkg_done_message() {
     # no message
     true
 }
index 35d4625c68f222ace7136fb576cdffd53cf94a48..ca41f2c182baf94795244dae9c85e1ef96c324aa 100644 (file)
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 set -e
 set -u
 
@@ -6,7 +8,7 @@ pkg_cmd_name="postgres"
 
 POSTGRES_DATA_DIR=$HOME/.local/share/postgres/var
 
-pkg_get_current_version() {
+function pkg_get_current_version() {
     # 'postgres --version' has output in this format:
     #       postgres (PostgreSQL) 10.13
     # This trims it down to just the version number:
@@ -14,7 +16,7 @@ pkg_get_current_version() {
     echo "$(postgres --version 2> /dev/null | head -n 1 | cut -d' ' -f3)"
 }
 
-pkg_install() {
+function pkg_install() {
     # mkdir -p $HOME/.local/opt
     mkdir -p "$(dirname $pkg_src)"
 
@@ -22,7 +24,7 @@ pkg_install() {
     mv ./"p"* "$pkg_src"
 }
 
-pkg_link() {
+function pkg_link() {
     # rm -f "$HOME/.local/opt/postgres"
     rm -f "$pkg_dst"
     rm -f "$HOME/Applications/pgAdmin"*.app || true
@@ -33,7 +35,7 @@ pkg_link() {
     ln -s "$pkg_src/pgAdmin 4.app" "$HOME/Applications/pgAdmin 4.app" || true
 }
 
-pkg_post_install() {
+function pkg_post_install() {
     webi_path_add "$pkg_dst_bin"
 
     #echo "Initializing PostgreSQL with database at $POSTGRES_DATA_DIR/"
@@ -51,7 +53,7 @@ pkg_post_install() {
     fi
 }
 
-pkg_done_message() {
+function pkg_done_message() {
     # TODO show with serviceman
     echo "Installed 'postgres' and 'psql' at $pkg_dst"
     echo ""
index 325424455fea6f108254cf3fb59ae6f15b854293..7f2aecc5fbea239003c2160796d30ec5a0dda52e 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: PostgreSQL (Postgres alias)
 # homepage: https://webinstall.dev/postgres
 # tagline: Alias for https://webinstall.dev/postgres
index 5a81b9bbecd98e009d9e12907eaabc208bc85cde..01f5d02477757dcfd2050ce0160b3ad7c9207f42 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_powershell() {
     set -e
     set -u
 
@@ -40,3 +40,5 @@
         echo "Installed 'pwsh' at $pkg_dst"
     }
 }
+
+__init_powershell
index 7df196f687cff355053b8c08012e7e55461f51e0..cf26aae440ef816fc26fbae78e8ad1612494cadf 100644 (file)
@@ -1,7 +1,11 @@
 #!/bin/bash
 
-if [ -z "$(npm --version 2> /dev/null)" ]; then
-    webi node
-    export PATH="$HOME/.local/opt/node/bin:$PATH"
-fi
-npm install -g prettier@latest
+function __init_prettier() {
+    if [ -z "$(npm --version 2> /dev/null)" ]; then
+        webi node
+        export PATH="$HOME/.local/opt/node/bin:$PATH"
+    fi
+    npm install -g prettier@latest
+}
+
+__init_prettier
index 194fae24a3c4b438c83e5dee4f759e8b47145821..d40fecb37c9034f73813df293d9db02a29501a2b 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: PowerShell (pwsh alias)
 # homepage: https://webinstall.dev/powershell
 # tagline: Alias for https://webinstall.dev/powershell
index 88afcb3d920ae66098f1d66e8c8e068805bfd623..397e1a90c5a7a6ab5cd6c15cd75af81dab4475d5 100644 (file)
@@ -2,7 +2,7 @@
 set -e
 set -u
 
-function __install_rg() {
+function __init_rg() {
 
     ###################
     # Install ripgrep #
@@ -39,4 +39,4 @@ function __install_rg() {
     }
 }
 
-__install_rg
+__init_rg
index 59b5ea753619ebbde669725b744f371063f63dc0..9740211545151495faf2dc66393cfbb0c2d2365c 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: Ripgrep (alias)
 # homepage: https://webinstall.dev/rg
 # tagline: `ripgrep` (project) is an alias for `rg` (command)
index 6f2f87ec6a0f453738926bb4b098cf47fcfd58bb..33c06cb9d388780e5124a06df9893bc4bbb49617 100644 (file)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # title: Rust (rustlang alias)
 # homepage: https://webinstall.dev/rustlang
 # tagline: Alias for https://webinstall.dev/rustlang
index fb4ea8a9cbf3aa8061afbd5a619c4d3f683fef4e..0d73cddee33a1d1e6ab83c5c7d78136f62deea3d 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_sd() {
     set -e
     set -u
 
@@ -36,3 +36,5 @@
     }
 
 }
+
+__init_sd
index 016b420cdc62143cff0b14cf316fc2bb7a7a1347..c2d212313b5ba84a6060eee80cededa1109610c7 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_shfmt() {
     set -e
     set -u
 
@@ -28,3 +28,5 @@
     }
 
 }
+
+__init_shfmt
index 811377f243b7515496bbab09b60fb71466b8d707..e0be04bea3e74015122aabdcfecc75d4cf6c6ca9 100644 (file)
@@ -1,7 +1,11 @@
-{
+#!/bin/bash
+
+function __init_ssh_utils() {
     rm -f "$HOME/.local/bin/ssh-pubkey" "$HOME/.local/bin/ssh-setpass" "$HOME/.local/bin/ssh-adduser"
     webi_download "$WEBI_HOST/packages/ssh-utils/ssh-pubkey.sh" "$HOME/.local/bin/ssh-pubkey"
     webi_download "$WEBI_HOST/packages/ssh-utils/ssh-setpass.sh" "$HOME/.local/bin/ssh-setpass"
     webi_download "$WEBI_HOST/packages/ssh-utils/ssh-adduser.sh" "$HOME/.local/bin/ssh-adduser"
     chmod a+x "$HOME/.local/bin/ssh-"*
 }
+
+__init_ssh_utils
index 4d399cd98fec5ab5573ac8b9789133bed4f7c201..a68cf5765b5a8669d1e8769e8c99d0bf80171651 100644 (file)
@@ -1,8 +1,10 @@
 #!/bin/bash
 
-{
+function __init_ssh_setpass() {
     set -e
     set -u
 
     ssh-keygen -p -f "$HOME/.ssh/id_rsa"
 }
+
+__init_ssh_setpass
index 4724b3dc911bcadab365168c4e16b59953070bc8..679c86b9a85c361b0894f82740998a4b01038041 100644 (file)
@@ -1,7 +1,9 @@
+#!/bin/bash
+
 set -e
 set -u
 
-{
+function __init_sudo() {
 
     if [ -z "$(command -v sudo)" ]; then
         echo >&2 "Error: on Linux and BSD you should install sudo via the native package manager"
@@ -12,3 +14,5 @@ set -u
     fi
 
 }
+
+__init_sudo
index ea8bcd00e7864dc9fc2147edbc8eac6dcd7c197a..3509710d46b58ec3d5f7541e533bba20b49be473 100644 (file)
@@ -1,24 +1,29 @@
-# mostly lightweight, or essential
-webi \
-    vim-leader \
-    vim-shell \
-    vim-sensible \
-    vim-viminfo \
-    vim-lastplace \
-    vim-spell \
-    vim-ale \
-    vim-prettier \
-    vim-whitespace
+#!/bin/bash
 
-# requires special hardware (mouse) or software (nerdfont)
-webi \
-    vim-gui \
-    vim-nerdtree \
-    nerdfont \
-    vim-devicons
+function __init_vim_beyondcode() {
+    # mostly lightweight, or essential
+    webi \
+        vim-leader \
+        vim-shell \
+        vim-sensible \
+        vim-viminfo \
+        vim-lastplace \
+        vim-spell \
+        vim-ale \
+        vim-prettier \
+        vim-whitespace
 
-if [ -n "$(command -v go)" ]; then
-    webi vim-go
-fi
+    # requires special hardware (mouse) or software (nerdfont)
+    webi \
+        vim-gui \
+        vim-nerdtree \
+        nerdfont \
+        vim-devicons
 
-# done
+    if [ -n "$(command -v go)" ]; then
+        webi vim-go
+    fi
+    # done
+}
+
+__init_vim_beyondcode
index 9be7ed71e7dc3191cad45006494afb1c13de0204..8c446b3775eaaaba3d1b93d65ad0b19181f8fae6 100644 (file)
@@ -1,22 +1,28 @@
-webi \
-    vim-leader \
-    vim-shell \
-    vim-sensible \
-    vim-viminfo \
-    vim-lastplace \
-    vim-spell \
-    vim-ale \
-    vim-prettier \
-    vim-whitespace
-# done
+#!/bin/bash
 
-printf '\n'
-printf 'Suggestion: Also check out these great plugins:\n'
-printf '\n'
-printf '    - vim-nerdtree (better than the default file browser)\n'
-printf '    - vim-gui      (mouse & clipboard support)\n'
-printf '    - vim-devicons (use nerdfont icons in vim)\n'
-printf '\n'
-printf '    - vim-go       (golang linting, etc)\n'
-printf '    - vim-rust     (rustlang linting, etc)\n'
-printf '\n'
+function __init_vim_essentials() {
+    webi \
+        vim-leader \
+        vim-shell \
+        vim-sensible \
+        vim-viminfo \
+        vim-lastplace \
+        vim-spell \
+        vim-ale \
+        vim-prettier \
+        vim-whitespace
+    # done
+
+    printf '\n'
+    printf 'Suggestion: Also check out these great plugins:\n'
+    printf '\n'
+    printf '    - vim-nerdtree (better than the default file browser)\n'
+    printf '    - vim-gui      (mouse & clipboard support)\n'
+    printf '    - vim-devicons (use nerdfont icons in vim)\n'
+    printf '\n'
+    printf '    - vim-go       (golang linting, etc)\n'
+    printf '    - vim-rust     (rustlang linting, etc)\n'
+    printf '\n'
+}
+
+__init_vim_essentials
index dd0bf5ba16008fa8e1c0f2a2bab7dd10dca6efef..12ddbcdc4b0434f651a4fed2eb915a663346979c 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_vps_addswap() {
     set -e
     set -u
 
@@ -31,3 +31,5 @@
     # Cause swap to be activated on boot
     echo '/var/swapfile none swap sw 0 0' | tee -a /etc/fstab
 }
+
+__init_vps_addswap "$@"
index 1f664e941d580e6565bb14fbc745079abd4d76d2..1e260a95281e2bc40ebae6d65675176144e73c4a 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_vps_utils() {
     set -e
     set -u
 
@@ -13,3 +13,5 @@
     chmod a+x "$HOME/.local/bin/myip"
     chmod a+x "$HOME/.local/bin/vps-"*
 }
+
+__init_vps_utils
index 99d4f0db286e64b20379983160f1b8d5edb2e3c7..d6fba6ea16f9608a6b2beeed93437d6b490dee1f 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_watchexec() {
     set -e
     set -u
 
@@ -37,3 +37,5 @@
     }
 
 }
+
+__init_watchexec
index 7ff18a569336438a3dd4e54004ec079474cb9d08..390ea1d0c6f1ca9cf36d4f4e82a65f0c60cb557e 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_xz() {
     set -e
     set -u
 
@@ -45,3 +45,5 @@
         echo $(xz --version 2> /dev/null | head -n 1 | cut -d ' ' -f 4)
     }
 }
+
+__init_xz
index f1651347c0f2da1a28682aa7e4a4f5f58b2c6505..8e445a5184259388388619b3b88ee637a04d9b99 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-{
+function __init_yq() {
     set -e
     set -u
 
@@ -34,3 +34,5 @@
     }
 
 }
+
+__init_yq
index 2111e3b45bc5a642202b59c62676a1b475d87129..c9383b68f9001e1a1a3bab666048e4d1c2ab5732 100644 (file)
@@ -33,7 +33,7 @@ function __init_zoxide() {
         #       zoxide v0.5.0-31-g8452961
         # This trims it down to just the version number:
         #       0.5.0
-        zoxide --version 2>/dev/null | head -n 1 | cut -d '-' -f 1 | cut -b '9-'
+        zoxide --version 2> /dev/null | head -n 1 | cut -d '-' -f 1 | cut -b '9-'
     }
 
     # shellcheck disable=SC2016