aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-04-18 11:23:01 +0000
committermerakor <cem@ckyln.com>2020-04-18 11:23:01 +0000
commitc72bbe9c5928ddd8e44b51e59aa23fd2a300a81d (patch)
tree2b57bcb228ff477fe8aaad1886c4fe872b859ddd /kiss
parent804d48ebbd2ac96e2a80df9123c27f41e557d5ed (diff)
downloadcpt-c72bbe9c5928ddd8e44b51e59aa23fd2a300a81d.tar.gz
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 -> FossilOrigin-Name: 932c33ed80618a6c88baf09f714050adad288cfae7e21ec32a8f38c964e2bfc8
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss6
1 files changed, 3 insertions, 3 deletions
diff --git a/kiss b/kiss
index 6578909..8fc369b 100755
--- 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|'')