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

View file

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