Commit: 238e74cf98955f7c0bdbb28858db8765f69be7fb
Parent: bc26db5d48fa56674ef00574ae0b6459ace36a78
Author: Klemens Nanni
Date: Thu, 15 Sep 2016 23:29:42 +0200
Clarify ambigious check() call, remove line break
The check() call determines whether the next command will be executed or
not, this makes it much clearer to read.
Diffstat:
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/spm.sh b/spm.sh
@@ -38,7 +38,7 @@ check() {
[ $(printf '%s' "${entry}" | wc -l) -gt 0 ] \
&& usage "Ambigious keyword. Try 'spm search'"
- [ -z "${entry}" ] && usage 'No such entry'
+ [ -n "${entry}" ] || usage 'No such entry'
}
gpg() {
@@ -88,19 +88,16 @@ list() {
del() {
entry=$(_find "${1}" | head -n2)
- check
- rm -i "${entry}"; printf '\n'
+ check && rm -i "${entry}" && printf '\n'
}
search() {
- _find "${1}" '%P\n' \
- | view
+ _find "${1}" '%P\n' | view
}
show() {
entry=$(_find "${1}" | head -n2)
- check
- gpg --decrypt "${entry}"
+ check && gpg --decrypt "${entry}"
}
## Parse input
@@ -116,7 +113,7 @@ case "${1}" in
;;
list)
if [ "${2}" = -g ] && [ ${#} -le 3 ]; then
- groups_only=1 && shift 1
+ groups_only=1; shift 1
elif [ ${#} -gt 3 ]; then
usage 'Wrong number of arguments'
fi