diff --git a/functions/_fish_deps_catalog.fish b/functions/_fish_deps_catalog.fish index 79c27a0..02c2e0a 100644 --- a/functions/_fish_deps_catalog.fish +++ b/functions/_fish_deps_catalog.fish @@ -36,8 +36,8 @@ function _fish_deps_catalog set -g _fdc_special \ "" rustup-installer fisher-bootstrap curl-installer fzf-update "" "" paru-build \ - pipx "" \ - "" "" "" "" "" "" "" "" "" "" "" "" "" "" + wakatime-binary "" \ + "" "" "" "" "" "" "" "" "" "" curl-lazydocker "" "" "" end # Returns the index (1-based) of $argv[1] in the catalog, or "" if not found. diff --git a/functions/_fish_deps_install.fish b/functions/_fish_deps_install.fish index d50bae6..f56f902 100644 --- a/functions/_fish_deps_install.fish +++ b/functions/_fish_deps_install.fish @@ -32,19 +32,26 @@ function _fish_deps_install end end - # rustup installer — listed before system PM so it is the default for cargo itself - if test "$special" = rustup-installer - set -a methods special-rustup - set -a method_labels "rustup installer (curl | sh)" + # Preferred special methods — listed before system PM so they are the default + switch $special + case rustup-installer + set -a methods special-rustup + set -a method_labels "rustup installer (curl | sh)" + case curl-lazydocker + set -a methods special-lazydocker + set -a method_labels "curl installer (official script)" + case wakatime-binary + set -a methods special-wakatime + set -a method_labels "binary download (github releases)" end - # System PM — after cargo/rustup so those are always the default when available + # System PM — after cargo and preferred specials if test -n "$pm_pkg"; and test -n "$pm" set -a methods pm set -a method_labels "$pm ($pm_pkg)" end - # Remaining special methods + # Supplemental special methods (fallbacks, Arch-only, etc.) switch $special case fzf-update set -a methods special-fzf @@ -129,6 +136,33 @@ function _fish_deps_install echo " cargo not yet in PATH — restart your shell if subsequent installs fail." set_color normal end + case special-lazydocker + curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash + case special-wakatime + set -l _arch (uname -m) + switch $_arch + case x86_64 + set _arch amd64 + case aarch64 arm64 + set _arch arm64 + case armv7l + set _arch arm + case '*' + set _arch amd64 + end + set -l _zip "wakatime-cli-linux-$_arch.zip" + set -l _bin_src "wakatime-cli-linux-$_arch" + set -l _wt_dir "$HOME/.config/wakatime" + set -l _wt_bin "$_wt_dir/wakatime" + set -l _tmpdir (mktemp -d) + curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \ + -o "$_tmpdir/$_zip" + and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir" + and mkdir -p "$_wt_dir" "$HOME/.local/bin" + and cp "$_tmpdir/$_bin_src" "$_wt_bin" + and chmod +x "$_wt_bin" + and ln -sf "$_wt_bin" "$HOME/.local/bin/wakatime" + rm -rf "$_tmpdir" case special-fzf fzf-update case special-fisher diff --git a/functions/_fish_deps_update.fish b/functions/_fish_deps_update.fish index eff4cdd..1bce7ac 100644 --- a/functions/_fish_deps_update.fish +++ b/functions/_fish_deps_update.fish @@ -48,6 +48,40 @@ function _fish_deps_update continue end + # lazydocker: re-run the official install/update script + if test "$special" = curl-lazydocker + echo "Updating $bin..." + curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash + set updated_any 1 + set i (math $i + 1) + continue + end + + # wakatime: re-download the binary from github releases + if test "$special" = wakatime-binary + echo "Updating $bin..." + set -l _arch (uname -m) + switch $_arch + case x86_64; set _arch amd64 + case aarch64 arm64; set _arch arm64 + case armv7l; set _arch arm + case '*'; set _arch amd64 + end + set -l _zip "wakatime-cli-linux-$_arch.zip" + set -l _bin_src "wakatime-cli-linux-$_arch" + set -l _wt_bin "$HOME/.config/wakatime/wakatime" + set -l _tmpdir (mktemp -d) + curl -L "https://github.com/wakatime/wakatime-cli/releases/latest/download/$_zip" \ + -o "$_tmpdir/$_zip" + and unzip -o "$_tmpdir/$_zip" -d "$_tmpdir" + and cp "$_tmpdir/$_bin_src" "$_wt_bin" + and chmod +x "$_wt_bin" + rm -rf "$_tmpdir" + and set updated_any 1 + set i (math $i + 1) + continue + end + # pipx tools if test "$special" = pipx if type -q pipx