Moved dex to seperate file

This commit is contained in:
Armel van Ravels
2026-07-07 09:53:33 +02:00
parent fb978f98e5
commit 93f98b0bd9
2 changed files with 61 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
{
home.file.".zsh/fastfetch.jsonc".source = ./fastfetch/config.jsonc;
home.file.".zsh/functions/dex.zsh".source = ./zsh/functions/dex.zsh;
programs.zsh = {
enable = true;
@@ -15,31 +16,7 @@
# Use kitty's ssh helper if running inside kitty
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh"
dex() {
local container
container=$(
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}' \
| tail -n +2 \
| fzf \
--header='Select container' \
--height=80% \
--layout=reverse \
--border \
--preview 'docker logs -f --tail=30 {1} 2>&1' \
--preview-window='right,65%,follow,border-left' \
| awk '{print $1}'
)
[ -z "$container" ] && return 0
docker exec -it "$container" sh -c '
if command -v bash >/dev/null 2>&1; then
exec bash
else
exec sh
fi
'
}
source ~/.zsh/functions/dex.zsh
'';
};
}