aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-04-19 18:47:40 +0000
committermerakor <cem@ckyln.com>2020-04-19 18:47:40 +0000
commit19cee3a2e1cc7af20365f63548dfb21560790d2a (patch)
treeefce2b95861d2274d42dc8477654e1ecaf4eaf08
parent6ac0ee532babf0a0e50e0b7fbd2a2857bf0545ed (diff)
downloadcpt-19cee3a2e1cc7af20365f63548dfb21560790d2a.tar.gz
kiss: implement user scripts from upstream
FossilOrigin-Name: ee011fef1c32c0dc066d933c12a450634510ae213ca3bbabad8d75ffcf5362ac
-rwxr-xr-xkiss45
1 files changed, 33 insertions, 12 deletions
diff --git a/kiss b/kiss
index 1431f7b..f08b195 100755
--- a/kiss
+++ b/kiss
@@ -128,7 +128,7 @@ pkg_find() {
set +f
for path2 in "$path/"$query; do
- [ -d "$path2" ] && set -f -- "$@" "$path2"
+ [ -e "$path2" ] && set -f -- "$@" "$path2"
done
done
@@ -1338,19 +1338,40 @@ args() {
h|help|-h|--help|'')
log 'kiss [a|b|c|f|i|l|r|s|u|v] [pkg] [pkg] [pkg]'
- log 'alternatives: List and swap to alternatives'
- log 'build: Build a package'
- log 'checksum: Generate checksums'
- log 'fetch: Fetch repositories'
- log 'install: Install a package'
- log 'list: List installed packages'
- log 'remove: Remove a package'
- log 'search: Search for a package'
- log 'update: Check for updates'
- log 'version: Package manager version'
+ log 'alternatives List and swap to alternatives'
+ log 'build Build a package'
+ log 'checksum Generate checksums'
+ log 'fetch Fetch repositories'
+ log 'install Install a package'
+ log 'list List installed packages'
+ log 'remove Remove a package'
+ log 'search Search for a package'
+ log 'update Check for updates'
+ log 'version Package manager version
+ '
+ log "Installed extensions (kiss-* in \$PATH)"
+
+ set --
+
+ for path in $(KISS_PATH=$PATH pkg_find kiss-* all); do
+ set -- "${path#*/kiss-}" "$@"
+ max=$((${#1} > max ? ${#1} : max))
+ done
+
+ for path do
+ printf '\033[31;1m->\033[m %-*s ' "$max" "${path#*/kiss-}"
+ sed -n 's/^# *//;2p' "$(command -v "kiss-$path")"
+ done | sort -uk1 >&2
+
;;
- *) die "'kiss $action' is not a valid command" ;;
+ *)
+ util=$(KISS_PATH=$PATH pkg_find "kiss-$action"* 2>/dev/null) ||
+ die "'kiss $action' is not a valid command"
+
+ "$util" "$@"
+ ;;
+
esac
}