diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-04-17 21:19:07 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-04-17 21:19:07 +0200 |
| commit | ba6dd3256c9508ed0c71c7f3346d910803d54a46 (patch) | |
| tree | 0a9481d520bd190fa4085934714bbfb987122be1 /bin | |
| parent | 932179c84fd566d821e05da91c4924d7cb0e591f (diff) | |
update
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/cle | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2,7 +2,14 @@ clip() { print "$1" | tee /dev/tty | head -n 1 | pbcopy; } -del() { rm -i ~/.cle/"$1"; } +checkpath() { set -- $(realpath "$1"); [ "${1#~/.cle/}" != "$1" ]; } + +del() { + set -- ~/.cle/"$1" + checkpath "$1" || die "invalid path $1" + rm -i "$1" + rmdir -p "${1%/*}" 2>/dev/null || true +} die() { echo "$@" >&2; exit 1; } |
