cpt

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

commit 3df6f782cef201f2f453b4f4f8b42200ee2f2dc2
parent 2cd5e9b27fed4c973333edbe518628ee11f43dc6
Author: Cem Keylan <cem@ckyln.com>
Date:   Sun, 19 Apr 2020 00:43:27 +0300

kiss: split search into singlesearch and search

Outputting only a single directory on subshells disregard alternative
use-cases where the user might actually want the full output. There
might be alternative use-cases where the user might want single output
without the use of a subshell. This change is to be sane while keeping
up with most use-cases.

Diffstat:
Mkiss | 14++++++++------
1 file changed, 8 insertions(+), 6 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 IFS=:; set -- + query=$1 match=$2 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. - [ -t 1 ] && printf '%s\n' "$@" || printf '%s\n' "$1" + [ "$match" ] && printf '%s\n' "$@" || printf '%s\n' "$1" } pkg_list() { @@ -1330,10 +1330,11 @@ args() { done ;; - b|build) pkg_build "${@:?No packages installed}" ;; - l|list) pkg_list "$@" ;; - u|update) pkg_updates ;; - s|search) for pkg do pkg_find "$pkg"; done ;; + b|build) pkg_build "${@:?No packages installed}" ;; + l|list) pkg_list "$@" ;; + u|update) pkg_updates ;; + s|search) for pkg do pkg_find "$pkg" all; done ;; + ss|singlesearch) for pkg do pkg_find "$pkg"; done ;; v|version) log kiss 1.12.3 ;; h|help|-h|--help|'') @@ -1346,6 +1347,7 @@ args() { log 'list: List installed packages' log 'remove: Remove a package' log 'search: Search for a package' + log 'singlesearch: Output the first match of a package' log 'update: Check for updates' log 'version: Package manager version' ;;