commit:     f544817c6c3bf6820f349feffbbde2a73f2b7fd5
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 20 19:56:37 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 20 19:56:37 2023 +0000
URL:        https://gitweb.gentoo.org/proj/emacs-tools.git/commit/?id=f544817c

Avoid "&& die"

* 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 <AT> gentoo.org>

 ChangeLog     |  6 ++++++
 ctags.eselect | 12 ++++++------
 emacs.eselect | 10 +++++-----
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bdee010..d954d17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-08-20  Ulrich Müller  <u...@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  <u...@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

Reply via email to