Tmux & Container : Kill by current dir name.

This commit is contained in:
Dmitry Voronin 2024-01-31 18:25:30 +03:00
parent c153a75507
commit 48f6407cc2
2 changed files with 9 additions and 13 deletions

View file

@ -6,7 +6,7 @@ function ca() {
# Set default name. # Set default name.
# [[ "${name}" = "" ]] && name="main" # [[ "${name}" = "" ]] && name="main"
[[ "${name}" = "" ]] && name="${PWD##*/}" [[ "${name}" = "" ]] && name=$(parse_simplify "${PWD##*/}")
# Append box prefix. # Append box prefix.
name="box-${name}" name="box-${name}"
@ -33,13 +33,13 @@ function ca() {
} }
# Remove container box with specified name. # Remove container box with specified name.
# By default uses `main` name. # By default uses current dir name.
# Usage: ck [NAME] # Usage: ck [NAME]
function ck() { function ck() {
local name="${1}" local name="${1}"
# Set default name. # Set default name.
[[ "${name}" = "" ]] && name="main" [[ "${name}" = "" ]] && name=$(parse_simplify "${PWD##*/}")
# Append box prefix. # Append box prefix.
name="box-${name}" name="box-${name}"

View file

@ -6,7 +6,7 @@ function ta() {
# Set default name. # Set default name.
# [[ "${name}" = "" ]] && name="main" # [[ "${name}" = "" ]] && name="main"
[[ "${name}" = "" ]] && name="${PWD##*/}" [[ "${name}" = "" ]] && name=$(parse_simplify "${PWD##*/}")
# Create session. # Create session.
tmux new-session -s "${name}" -d &> /dev/null tmux new-session -s "${name}" -d &> /dev/null
@ -55,18 +55,14 @@ function tnw() {
} }
# Kill specified session. # Kill specified session.
# By default it kills `main` session. # By default uses current dir name.
# Usage: tk [NAME] # Usage: tk [NAME]
function tk() { function tk() {
# set default name. local name="${1}"
if [[ "${1}" = "" ]]; then
1="main"
fi
# call tmux. [[ "${name}" = "" ]] && name=$(parse_simplify "${PWD##*/}")
for name in "$@"; do
tmux kill-session -t "${name}" tmux kill-session -t "${name}"
done
} }
# Kill all sessions. # Kill all sessions.