From 9a7c837395f3c5d054b23851305dac2a553ac510 Mon Sep 17 00:00:00 2001 From: home Date: Sat, 25 Nov 2023 21:47:52 +0300 Subject: [PATCH] find : add find_types to find all filetypes. --- .README.md | 2 +- .config/bash/module/find.sh | 6 ++++++ .config/bash/module/tmux.sh | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .config/bash/module/find.sh diff --git a/.README.md b/.README.md index d26bee5..0e94bb7 100644 --- a/.README.md +++ b/.README.md @@ -632,7 +632,7 @@ Command|Description `ta [NAME]`|Attach to session by name. Default is `main`. `td`|Detach from session. `tl`|List all sessions. -`tr [NAME]`|Rename session. Uses current dir name by default. +`trn [NAME]`|Rename session. Uses current dir name by default. `tn [NAME]`|Name window. Uses current dir name by default. `tk [NAME]`|Kill session. Default is `main`. `tka`|Kill all sessions. diff --git a/.config/bash/module/find.sh b/.config/bash/module/find.sh new file mode 100644 index 0000000..35fe775 --- /dev/null +++ b/.config/bash/module/find.sh @@ -0,0 +1,6 @@ +# Find all file types recursively. +find_types() +{ + local types=($(find -type f | sed "s/.*\.//")) + echo "${types[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ' +} diff --git a/.config/bash/module/tmux.sh b/.config/bash/module/tmux.sh index 0d22bc2..2c9f5bb 100644 --- a/.config/bash/module/tmux.sh +++ b/.config/bash/module/tmux.sh @@ -19,8 +19,8 @@ alias td="tmux detach-client" alias tl="tmux list-sessions" # Rename current session. Uses current dir name by default. -# Usage: tr [NAME] -tr() +# Usage: trn [NAME] +trn() { local name="${1}"