Newer
Older
ops-toolkit / packs / shell / files / ops-functions.sh
@JANeumatrix JANeumatrix 2 hours ago 721 bytes Initial upload
# shellcheck shell=bash
# packs/shell/files/ops-functions.sh -- team ops helpers (sourced, not run).
# Everything here is read-only or explicitly named for what it does.
# ASCII + LF.

# ts NAME -- create-or-attach a tmux session (the durable-session habit).
ts() {
    if [ -z "${1:-}" ]; then
        echo "usage: ts <session-name>" >&2
        return 2
    fi
    tmux new-session -A -s "$1"
}

# tls -- list tmux sessions (empty list is a valid answer, not an error).
tls() {
    tmux ls 2>/dev/null || echo "no tmux sessions"
}

# mkcd DIR -- mkdir -p and cd into it.
mkcd() {
    if [ -z "${1:-}" ]; then
        echo "usage: mkcd <dir>" >&2
        return 2
    fi
    mkdir -p -- "$1" && cd -- "$1" || return 1
}