cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 2dea28515c0d149d225ad6722de4e9dd212a9019
parent 6b088d5608ccc3c8b046cf6611d6c9786d532c59
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 20 Apr 2020 20:57:37 +0300

kiss: check for the first argument

Instead of 'intense' shell arithmethic, we could just check if the first
argument is available. This is much more easier to read and understand.
It doesn't affect the speed of execution either.

Diffstat:
Mkiss | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kiss b/kiss @@ -1223,9 +1223,8 @@ args() { # the arguments that follow are all package names. action=$1 - # 'dash' exits on error here if 'shift' is used and there are zero - # arguments despite trapping the error ('|| :'). - shift "$(($# > 0 ? 1 : 0))" + # 'dash' gives an error when shift is used without any arguments. + [ "$1" ] && shift # Unless this is a search, sanitize the user's input. The call to # 'pkg_find()' supports basic globbing, ensure input doesn't expand