diff options
author | Ulrich Müller <ulm@gentoo.org> | 2023-08-20 21:56:37 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-08-20 21:56:37 +0200 |
commit | f544817c6c3bf6820f349feffbbde2a73f2b7fd5 (patch) | |
tree | d39336522bdf5348487125876c477332caa097cb | |
parent | Version 1.19 released (diff) | |
download | emacs-tools-eselect-emacs.tar.gz emacs-tools-eselect-emacs.tar.bz2 emacs-tools-eselect-emacs.zip |
Avoid "&& die"eselect-emacs
* ctags.eselect (do_show, do_list, do_set, do_update):
* emacs.eselect (do_show, do_list, do_set, do_update):
Use positive condition for argument checks.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ctags.eselect | 12 | ||||
-rw-r--r-- | emacs.eselect | 10 |
3 files changed, 17 insertions, 11 deletions
@@ -1,3 +1,9 @@ +2023-08-20 Ulrich Müller <ulm@gentoo.org> + + * ctags.eselect (do_show, do_list, do_set, do_update): + * emacs.eselect (do_show, do_list, do_set, do_update): + Use positive condition for argument checks. + 2021-08-02 Ulrich Müller <ulm@gentoo.org> * Version 1.19 released. diff --git a/ctags.eselect b/ctags.eselect index 72c95c9..99be1a6 100644 --- a/ctags.eselect +++ b/ctags.eselect @@ -1,5 +1,5 @@ # -*-eselect-*- -# Copyright 2005-2021 Gentoo Authors +# Copyright 2005-2023 Gentoo Authors # Distributed under the terms of the GNU GPL version 2 or later # # DOCUMENTATION @@ -106,7 +106,7 @@ describe_show() { } do_show() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -eq 0 ]] || die -q "Too many parameters" write_list_start "Current target of ${CTAGS} symlink:" if [[ -L ${EROOT}/usr/bin/${CTAGS} && -e ${EROOT}/usr/bin/${CTAGS} ]] @@ -128,7 +128,7 @@ describe_list() { } do_list() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -eq 0 ]] || die -q "Too many parameters" local i targets targets=( $(find_targets) ) @@ -158,8 +158,8 @@ describe_set_parameters() { } do_set() { - [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" - [[ $# -gt 1 ]] && die -q "Too many parameters" + [[ -n $1 ]] || die -q "You didn't tell me what to set the symlink to" + [[ $# -le 1 ]] || die -q "Too many parameters" test_for_root if [[ -e ${EROOT}/usr/bin/${CTAGS} && ! -L ${EROOT}/usr/bin/${CTAGS} ]] @@ -183,7 +183,7 @@ describe_update_options() { do_update() { [[ -z $1 || $1 = ifunset || $1 = --if-unset ]] || die -q "Usage error" [[ -z $2 || $2 = norecursion ]] || die -q "Usage error" - [[ $# -gt 2 ]] && die -q "Too many parameters" + [[ $# -le 2 ]] || die -q "Too many parameters" test_for_root if ! [[ $1 = *if*unset \ diff --git a/emacs.eselect b/emacs.eselect index f3880ed..7c5139c 100644 --- a/emacs.eselect +++ b/emacs.eselect @@ -173,7 +173,7 @@ describe_show() { } do_show() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -eq 0 ]] || die -q "Too many parameters" write_list_start "Current target of Emacs symlink:" if [[ -L ${EROOT}/usr/bin/emacs && -e ${EROOT}/usr/bin/emacs ]]; then @@ -199,7 +199,7 @@ describe_list() { } do_list() { - [[ $# -gt 0 ]] && die -q "Too many parameters" + [[ $# -eq 0 ]] || die -q "Too many parameters" local i targets targets=( $(find_targets) ) @@ -234,8 +234,8 @@ describe_set_parameters() { } do_set() { - [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" - [[ $# -gt 1 ]] && die -q "Too many parameters" + [[ -n $1 ]] || die -q "You didn't tell me what to set the symlink to" + [[ $# -le 1 ]] || die -q "Too many parameters" test_for_root if [[ -e ${EROOT}/usr/bin/emacs && ! -L ${EROOT}/usr/bin/emacs ]]; then @@ -260,7 +260,7 @@ describe_update_options() { do_update() { [[ -z $1 || $1 = ifunset || $1 = --if-unset ]] || die -q "Usage error" - [[ $# -gt 1 ]] && die -q "Too many parameters" + [[ $# -le 1 ]] || die -q "Too many parameters" test_for_root if [[ -L ${EROOT}/usr/bin/emacs ]]; then |