diff --git a/contrib/kiss-cargo-urlgen b/contrib/kiss-cargo-urlgen index ba14aa9..0ca8a15 100755 --- a/contrib/kiss-cargo-urlgen +++ b/contrib/kiss-cargo-urlgen @@ -1,7 +1,8 @@ #!/bin/sh +# Generate sources for rust packages. [ "$1" ] || { - printf 'usage: kiss-carg-urlgen [crate-ver] [crate-ver]\n' + printf 'usage: kiss-cargo-urlgen [crate-ver] [crate-ver]\n' exit 1 } diff --git a/contrib/kiss-chbuild b/contrib/kiss-chbuild index 28a1544..4b772b7 100755 --- a/contrib/kiss-chbuild +++ b/contrib/kiss-chbuild @@ -1,5 +1,4 @@ #!/bin/sh -e -# # Create/destroy temporary chroots. log() { diff --git a/contrib/kiss-chroot b/contrib/kiss-chroot index 258e793..c61233b 100755 --- a/contrib/kiss-chroot +++ b/contrib/kiss-chroot @@ -1,6 +1,5 @@ #!/bin/sh -e -# -# kiss-chroot: Enter a chroot. +# Enter a kiss chroot. log() { printf '\033[32m->\033[m %s.\n' "$*" diff --git a/contrib/kiss-depends b/contrib/kiss-depends index 185a80b..be23624 100755 --- a/contrib/kiss-depends +++ b/contrib/kiss-depends @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-depends - Display a package's dependencies. +# Display a package's dependencies. kiss l "${1:-null}" >/dev/null diff --git a/contrib/kiss-depends-finder b/contrib/kiss-depends-finder index 79fdd31..3c36494 100755 --- a/contrib/kiss-depends-finder +++ b/contrib/kiss-depends-finder @@ -1,5 +1,4 @@ #!/bin/sh -e -# # Find missing dependencies by parsing 'ldd'. kiss l "${1:-null}" >/dev/null diff --git a/contrib/kiss-export b/contrib/kiss-export index 4598177..3d9f3f4 100755 --- a/contrib/kiss-export +++ b/contrib/kiss-export @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-export - Turn an installed package into a KISS tarball. +# Turn an installed package into a KISS tarball. kiss l "${1:-null}" >/dev/null diff --git a/contrib/kiss-fork b/contrib/kiss-fork index 6e1245c..6e5acdb 100755 --- a/contrib/kiss-fork +++ b/contrib/kiss-fork @@ -1,4 +1,5 @@ #!/bin/sh -ef +# Copy a package's repository files into the current directory. kiss s "${1:-null}" >/dev/null || { printf 'usage: kiss-fork pkg_name\n' diff --git a/contrib/kiss-link b/contrib/kiss-link index 9412917..3cf5bc8 100755 --- a/contrib/kiss-link +++ b/contrib/kiss-link @@ -1,4 +1,5 @@ #!/bin/sh -ef +# Link a repository file to another repository. [ "$1" ] || { printf 'usage: kiss-link file\n' diff --git a/contrib/kiss-maintainer b/contrib/kiss-maintainer index 5039002..c5ece32 100755 --- a/contrib/kiss-maintainer +++ b/contrib/kiss-maintainer @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-maintainer - find the maintainer of a package. +# Find the maintainer of a package. kiss s "$1" | while read -r repo; do cd "$repo" m=$(git log -1 version 2>/dev/null) ||: diff --git a/contrib/kiss-manifest b/contrib/kiss-manifest index 39a01d9..e7d9fe2 100755 --- a/contrib/kiss-manifest +++ b/contrib/kiss-manifest @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-manifest - Display all files owned by a package. +# Display all files owned by a package. kiss l "${1:-null}" >/dev/null diff --git a/contrib/kiss-manifest-tree b/contrib/kiss-manifest-tree index 7fcfb8c..f5f938e 100755 --- a/contrib/kiss-manifest-tree +++ b/contrib/kiss-manifest-tree @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-manifest-tree - Display all files owned by a package. +# Display all files owned by a package in a tree. kiss l "${1:-null}" diff --git a/contrib/kiss-new b/contrib/kiss-new index c5ded48..db82dec 100755 --- a/contrib/kiss-new +++ b/contrib/kiss-new @@ -1,4 +1,5 @@ #!/bin/sh +# Create a boilerplate package. die() { printf 'error: %s.\n' "$*" >&2 diff --git a/contrib/kiss-orphans b/contrib/kiss-orphans index ff9530d..2130e84 100755 --- a/contrib/kiss-orphans +++ b/contrib/kiss-orphans @@ -1,6 +1,5 @@ #!/bin/sh -e -# -# kiss-orphans - List orphaned packages. +# List orphaned packages. cd "$KISS_ROOT/var/db/kiss/installed/" diff --git a/contrib/kiss-outdated b/contrib/kiss-outdated index db2b421..f95a1d4 100755 --- a/contrib/kiss-outdated +++ b/contrib/kiss-outdated @@ -1,5 +1,4 @@ #!/bin/sh -# # Check installed packages for updates. old_IFS=$IFS diff --git a/contrib/kiss-owns b/contrib/kiss-owns index 249c52c..b300e55 100755 --- a/contrib/kiss-owns +++ b/contrib/kiss-owns @@ -1,6 +1,5 @@ #!/bin/sh -e -# -# kiss-owns - Check which package owns a file. +# Check which package owns a file. # Strip 'KISS_ROOT' from the file path if passed and # follow symlinks. diff --git a/contrib/kiss-repodepends b/contrib/kiss-repodepends index fded3b2..2ef0bec 100755 --- a/contrib/kiss-repodepends +++ b/contrib/kiss-repodepends @@ -1,5 +1,4 @@ #!/bin/sh -# -# kiss-repodepends +# Display a package's original dependencies. -cat "$(kiss s "$1" | sed 1q)/depends" 2>/dev/null +cat "$(kiss s "$1")/depends" 2>/dev/null diff --git a/contrib/kiss-reset b/contrib/kiss-reset index aee6547..f7c9ef3 100755 --- a/contrib/kiss-reset +++ b/contrib/kiss-reset @@ -1,9 +1,8 @@ #!/bin/sh -ef +# Remove all packages except for the base. # # Disable word-splittng warnings as they're safe here. # shellcheck disable=SC2046 -# -# kiss-reset: Remove all packages except for the base. set -- diff --git a/contrib/kiss-revdepends b/contrib/kiss-revdepends index 5a181e5..d71026d 100755 --- a/contrib/kiss-revdepends +++ b/contrib/kiss-revdepends @@ -1,6 +1,5 @@ #!/bin/sh -e -# -# kiss-revdepends - Display packages which depend on package. +# Display packages which depend on package. # 'cd' to the database directory as a simple way of # stripping the path and performing a 'basename'. diff --git a/contrib/kiss-size b/contrib/kiss-size index 72365a4..367c26d 100755 --- a/contrib/kiss-size +++ b/contrib/kiss-size @@ -1,6 +1,5 @@ #!/bin/sh -ef -# -# kiss-size - Show the size on disk for a package. +# Show the size on disk for a package. db_dir=$KISS_ROOT/var/db/kiss/installed/${1-null} diff --git a/kiss b/kiss index 7be0807..56c6fb7 100755 --- a/kiss +++ b/kiss @@ -125,7 +125,7 @@ pkg_find() { set +f for path2 in "$path/"$query; do - [ -d "$path2" ] && set -f -- "$@" "$path2" + [ -e "$path2" ] && set -f -- "$@" "$path2" done done @@ -137,7 +137,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" + [ -t 1 ] || [ "$2" ] && printf '%s\n' "$@" || printf '%s\n' "$1" } pkg_list() { @@ -1334,18 +1334,38 @@ args() { h|help|-h|--help|'') log 'kiss [a|b|c|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 '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 '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)" + + KISS_PATH=$PATH + + for path in $(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" ;; + *) + command -v "kiss-$action" >/dev/null || + die "'kiss $action' is not a valid command" + + "kiss-$action" "$@" + ;; esac }