Compare commits

...

2 Commits

Author SHA1 Message Date
Kim
bde8524e25 fix usage
Some checks failed
continuous-integration/drone/push Build is failing
2021-09-21 21:09:15 +02:00
Kim
b441b73b06 fix usage 2021-09-21 21:08:59 +02:00
2 changed files with 8 additions and 5 deletions

View File

@ -77,4 +77,4 @@ steps:
pull: if-not-exists pull: if-not-exists
commands: commands:
- . $HOME/.bashrc - . $HOME/.bashrc
- trash || true - trash

View File

@ -11,7 +11,10 @@ usage() {
local func_args=$1 local func_args=$1
local func_name="$2" local func_name="$2"
if [[ $func_args == 0 ]]; then echo -e "At least one argument required:\n$func_name FILE1 DIR2 ..."; exit 1; fi if [[ $func_args == 0 ]];
then echo -e "At least one argument required:\n$func_name FILE1 DIR2 ..."
exit
fi
} }
trash_list() { trash_list() {
@ -19,7 +22,7 @@ trash_list() {
} }
trash_put() { trash_put() {
usage "$#" "$0" usage "$#" "${FUNCNAME[0]}"
for FILE in $@; do for FILE in $@; do
# Store old filepath for later restore # Store old filepath for later restore
@ -34,7 +37,7 @@ trash_empty() {
} }
trash_restore() { trash_restore() {
usage "$#" "$0" usage "$#" "${FUNCNAME[0]}"
for FILE_TO_RESTORE in "$@"; do for FILE_TO_RESTORE in "$@"; do
# Get old filepath for restore # Get old filepath for restore
@ -49,7 +52,7 @@ trash_restore() {
} }
trash_rm() { trash_rm() {
usage "$#" "$0" usage "$#" "${FUNCNAME[0]}"
#if [[ $# == 0 ]]; then echo -e "At least one argument required:\n$0 FILE1 DIR2 ..."; return 1; fi #if [[ $# == 0 ]]; then echo -e "At least one argument required:\n$0 FILE1 DIR2 ..."; return 1; fi
for FILE_TO_REMOVE in "$@"; do for FILE_TO_REMOVE in "$@"; do