Skip to content

Commit

Permalink
fix(fish/distrobox): load order, after setenv + gum bin logic
Browse files Browse the repository at this point in the history
  • Loading branch information
scottames committed Mar 29, 2024
1 parent 9bf3e92 commit 76dd39c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
7 changes: 7 additions & 0 deletions home/dot_setenv
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ setenv SHRUG "¯\\_(ツ)_/¯"
setenv TERM "xterm-256color"
setenv TMOUT 0
setenv VAGRANT_DEFAULT_PROVIDER "virtualbox"
setenv XAUTHLOCALHOSTNAME "$(hostnamectl hostname)"

setenv ZPLUG_HOME "$HOME/.zplug"
setenv ZPLUG_LOADFILE "$HOME/.zsh/zplugs.zsh"
Expand All @@ -77,6 +78,12 @@ $HAS_BAT \
$HAS_BAT \
&& setenv MANPAGER "sh -c 'col -bx | bat -l man -p'"

setenv GUM_BIN ""
$HAS_GUM \
&& setenv GUM_BIN "gum"
$HAS_UGUM \
&& setenv GUM_BIN "ugum"

# handy unicode
setenv TICK ""
setenv CROSS ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@
if status --is-login
and not is_container >/dev/null

if type -q distrobox-host-exec
and type -q fzf
if test -z $GUM_BIN
and type -q distrobox-host-exec
and type -q $GUM_BIN

set -l box (
begin
distrobox ls | tail -n +2 | tr -s ' ' | cut -d '|' -f 2,4 | string trim | sort
echo "none | shell"
end | ugum filter --timeout=10s --header="distrobox?" --placeholder="" | cut -d '|' -f 1 | string trim
end | $GUM_BIN filter --timeout=10s --header="distrobox?" --placeholder="" | cut -d '|' -f 1 | string trim
)

if [ "$box" != none ]
distrobox enter $box
end
else
if not type -q distrobox-host-exec
if test -z $GUM_BIN
printf_warn "missing GUM_BIN\n"
else if not type -q distrobox-host-exec
printf_warn "missing distrobox-host-exec\n"
else if not type -q fzf
printf_warn "missing fzf\n"
else if not type -q $GUM_BIN
printf_warn "$GUM_BIN not installed!?\n"
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ function distrobox_enter \

set -l gumBin

if $HAS_UGUM
set gumBin ugum
else if $HAS_GUM
set gumBin gum
else
if test -z $GUM_BINZ
printf_err "missing gum/ugum!"
return 1
end

set -l box (distrobox ls | tail -n +2 | tr -s ' ' | cut -d ' ' -f 3,8-9 | $gumBin choose | cut -d ' ' -f 1)
set -l box (distrobox ls | tail -n +2 | tr -s ' ' | cut -d ' ' -f 3,8-9 | $GUM_BIN choose | cut -d ' ' -f 1)
distrobox enter $box
end

0 comments on commit 76dd39c

Please sign in to comment.