From f85a6740c53227cd624ce47afaf132f8910743a7 Mon Sep 17 00:00:00 2001 From: Job79 Date: Fri, 27 Jun 2025 17:16:08 +0200 Subject: [PATCH] feat(enter): restore directory on container enter --- config/bashrc | 4 ++++ enter.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/bashrc b/config/bashrc index a176a76..cc8472d 100644 --- a/config/bashrc +++ b/config/bashrc @@ -1,5 +1,9 @@ . /etc/bashrc +# === container enter logic === +ENTER_DIR="${ENTER_DIR/#\~/$HOME}" +[ -d "$ENTER_DIR" ] && cd "$ENTER_DIR" + # === environment === export EDITOR=nvim \ WAYLAND_DISPLAY=wayland-0 \ diff --git a/enter.sh b/enter.sh index 1e9160e..172ceef 100755 --- a/enter.sh +++ b/enter.sh @@ -73,4 +73,4 @@ if [ "$force" = true ] || [ "$(podman container inspect "$name" -f {{.State.Runn fi podman start "$name" 1>/dev/null -podman exec --detach-keys "ctrl-@" -it "$name" bash -l +podman exec -e ENTER_DIR="${PWD/#$HOME/\~}" --detach-keys "ctrl-@" -it "$name" bash -l