Tmux & Container : Use current dir name when attaching by default instead of main.

This commit is contained in:
Dmitry Voronin 2024-01-31 17:47:55 +03:00
parent ccb9f5358a
commit c153a75507
3 changed files with 8 additions and 6 deletions

View file

@ -1,11 +1,12 @@
# Attach/create container box in current directory with specified name.
# Uses `main` name by default.
# By default uses current dir name.
# Usage: ca [NAME]
function ca() {
local name="${1}"
# Set default name.
[[ "${name}" = "" ]] && name="main"
# [[ "${name}" = "" ]] && name="main"
[[ "${name}" = "" ]] && name="${PWD##*/}"
# Append box prefix.
name="box-${name}"

View file

@ -1,11 +1,12 @@
# Create/attach to named session.
# By default uses name `main`.
# By default uses current dir name.
# Usage: ta [NAME]
function ta() {
local name="${1}"
# Set default name.
[[ "${name}" = "" ]] && name="main"
# [[ "${name}" = "" ]] && name="main"
[[ "${name}" = "" ]] && name="${PWD##*/}"
# Create session.
tmux new-session -s "${name}" -d &> /dev/null

View file

@ -78,7 +78,7 @@ Command|Description
Command|Description
---|---
`ca [NAME]`|Attach/create container box in current directory with specified name. Uses `main` name by default.
`ca [NAME]`|Attach/create container box in current directory with specified name. By default uses current dir name.
`ck [NAME]`|Remove container box with specified name. By default uses `main` name.
`cka`|Remove all container boxes.
`cl`|List all container boxes.
@ -367,7 +367,7 @@ Command|Description
Command|Description
---|---
`ta [NAME]`|Create/attach to named session. By default uses name `main`.
`ta [NAME]`|Create/attach to named session. By default uses current dir name.
`td`|Detach from running session.
`tda`|Detach all other tmux clients.
`tl`|List running sessions.