From 15c0252fdab6a84dee215739f8d3898bbcdf1453 Mon Sep 17 00:00:00 2001 From: druckdev Date: Thu, 22 Jul 2021 15:38:14 +0200 Subject: [PATCH] zsh:funcs: Create `trash` wrapper only if exists --- .config/zsh/zshrc.d/40-functions.zsh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.config/zsh/zshrc.d/40-functions.zsh b/.config/zsh/zshrc.d/40-functions.zsh index de14d36..159df90 100644 --- a/.config/zsh/zshrc.d/40-functions.zsh +++ b/.config/zsh/zshrc.d/40-functions.zsh @@ -286,14 +286,16 @@ crypt-umount() { udisksctl power-off -b "$1" } -## List items in trash if no argument is specified -trash() { - if (( ! $# )); then - command trash-list - else - command trash "$@" - fi -} +if (( $+commands[trash] )); then + ## List items in trash if no argument is specified + trash() { + if (( ! $# )); then + command trash-list + else + command trash "$@" + fi + } +fi ## Move one or more file(s) but keep a symlink to the new location. mvln() {