cpt

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

commit fce1c70065d62df451b15d624e91af38e22a7f91
parent 336271d3c9ede7e7d251518fdf5918964512e8e8
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Sat, 18 Apr 2020 09:54:05 +0300

kiss: Make 'kiss s' usage saner for scripting.

Changes 'kiss s' to only show the first match if run from a
subshell. Here's a simple example:

-> kiss s zlib
/home/dylan/projects/repo/core/zlib
/var/db/kiss/installed/zlib
-> echo $(kiss s zlib)
/home/dylan/projects/repo/core/zlib
->

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

diff --git a/kiss b/kiss @@ -120,7 +120,7 @@ pkg_find() { # Figure out which repository a package belongs to by # searching for directories matching the package name # in $KISS_PATH/*. - query=$1 match=$2 IFS=:; set -- + query=$1 IFS=:; set -- # Word splitting is intentional here. # shellcheck disable=2086 @@ -140,7 +140,7 @@ pkg_find() { # Show all search results if called from 'kiss search', else # print only the first match. - [ "$match" ] && printf '%s\n' "$@" || printf '%s\n' "$1" + [ -t 1 ] && printf '%s\n' "$@" || printf '%s\n' "$1" } pkg_list() { @@ -1336,7 +1336,7 @@ args() { l|list) pkg_list "$@" ;; u|update) pkg_updates ;; - s|search) for pkg do pkg_find "$pkg" all; done ;; + s|search) for pkg do pkg_find "$pkg"; done ;; v|version) log kiss 1.12.3 ;; h|help|-h|--help|'')