diff --git a/functions.d/devenv b/functions.d/devenv new file mode 100644 index 0000000..e93826d --- /dev/null +++ b/functions.d/devenv @@ -0,0 +1,18 @@ +#!/bin/bash + +function devenv() { + + local status + + # Get LXC container status + status=$(lxc info devenv | yq .Status) + + # Start container if not running + if [ "${status}" != "RUNNING" ]; then lxc start devenv; fi + + # Rename tmux window if inside tmux + if [ -n "$TMUX" ]; then tmux rename-window "devenv"; fi + + # Login as user xavier + lxc exec devenv -- login -f xavier +}