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. # Attach/create container box in current directory with specified name.
# Uses `main` name by default. # By default uses current dir name.
# Usage: ca [NAME] # Usage: ca [NAME]
function ca() { function ca() {
local name="${1}" local name="${1}"
# Set default name. # Set default name.
[[ "${name}" = "" ]] && name="main" # [[ "${name}" = "" ]] && name="main"
[[ "${name}" = "" ]] && name="${PWD##*/}"
# Append box prefix. # Append box prefix.
name="box-${name}" name="box-${name}"

View file

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

View file

@ -78,7 +78,7 @@ Command|Description
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. `ck [NAME]`|Remove container box with specified name. By default uses `main` name.
`cka`|Remove all container boxes. `cka`|Remove all container boxes.
`cl`|List all container boxes. `cl`|List all container boxes.
@ -367,7 +367,7 @@ Command|Description
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. `td`|Detach from running session.
`tda`|Detach all other tmux clients. `tda`|Detach all other tmux clients.
`tl`|List running sessions. `tl`|List running sessions.