diff options
| author | bh <qn+git@epicurus.dev> | 2026-03-31 12:34:25 +0800 |
|---|---|---|
| committer | bh <qn+git@epicurus.dev> | 2026-03-31 12:34:25 +0800 |
| commit | e6e212e7e595df845ff3cfa9818f2cff28812a33 (patch) | |
| tree | b6a9098ea463985cf8b93f8f8123139fccb763f1 | |
| parent | bc697d790d49138c5032420d2cf37d8b302c3479 (diff) | |
zsh: improve take function
| -rw-r--r-- | zsh/.zshrc | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -92,6 +92,23 @@ alias tt="~/Scripts/tt" alias vimv="~/Scripts/vimv" # ┌──────────────────────────────────────────────────────────────┐ +# │ ⚙️ Functions +# └──────────────────────────────────────────────────────────────┘ +takedir() { + if [[ $# -eq 1 ]]; then + mkdir -p "$1" && cd "$1" + elif [[ $# -ge 2 ]]; then + local dest="${@:$#}" + mkdir -p "$dest" + mv "${@:1:$#-1}" "$dest" + cd "$dest" + else + echo "usage: take <dir> OR take <sources...> <destdir>" + return 1 + fi +} + +# ┌──────────────────────────────────────────────────────────────┐ # │ 🎯 Prompt │ # └──────────────────────────────────────────────────────────────┘ # To customize, run `p10k configure` or edit ~/.p10k.zsh |
