Tmux & Container : Kill by current dir name.
This commit is contained in:
parent
c153a75507
commit
48f6407cc2
|
@ -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}"
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Reference in a new issue