aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-13 19:51:21 +0000
committermerakor <cem@ckyln.com>2020-05-13 19:51:21 +0000
commitc68dffa6c42334cfa939fb21a5430a35abff08c0 (patch)
tree851e5fc23981c030ecaebe53cd100a2f1edd4964 /contrib
parent77cf1dab6537557b5ae43e1aee76972f87c829c0 (diff)
downloadcpt-c68dffa6c42334cfa939fb21a5430a35abff08c0.tar.gz
contrib: use --help and -h for usage information
FossilOrigin-Name: 43f55b077d3feb3e4bc42d72a58cadedbe7f387cedf01d2e59308c35f6afb484
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/kiss-cargo-urlgen5
-rwxr-xr-xcontrib/kiss-cargolock-urlgen2
-rwxr-xr-xcontrib/kiss-cat2
-rwxr-xr-xcontrib/kiss-changelog5
-rwxr-xr-xcontrib/kiss-chbuild1
-rwxr-xr-xcontrib/kiss-chroot2
-rwxr-xr-xcontrib/kiss-depends2
-rwxr-xr-xcontrib/kiss-depends-finder4
-rwxr-xr-xcontrib/kiss-export2
-rwxr-xr-xcontrib/kiss-fork2
-rwxr-xr-xcontrib/kiss-link2
-rwxr-xr-xcontrib/kiss-maintainer2
-rwxr-xr-xcontrib/kiss-manifest2
-rwxr-xr-xcontrib/kiss-manifest-tree2
-rwxr-xr-xcontrib/kiss-message5
-rwxr-xr-xcontrib/kiss-new6
-rwxr-xr-xcontrib/kiss-orphans9
-rwxr-xr-xcontrib/kiss-owns2
-rwxr-xr-xcontrib/kiss-repodepends2
-rwxr-xr-xcontrib/kiss-reporevdepends5
-rwxr-xr-xcontrib/kiss-revdepends2
-rwxr-xr-xcontrib/kiss-size2
-rwxr-xr-xcontrib/kiss-which2
23 files changed, 29 insertions, 41 deletions
diff --git a/contrib/kiss-cargo-urlgen b/contrib/kiss-cargo-urlgen
index 4229062..52a10eb 100755
--- a/contrib/kiss-cargo-urlgen
+++ b/contrib/kiss-cargo-urlgen
@@ -1,9 +1,6 @@
#!/bin/sh
# Create static cargo sources for Rust packages
-[ "$1" ] || {
- printf '\033[1;33m-> \033[musage: kiss-cargo-urlgen [crate+ver] [crate+ver]\n'
- exit 1
-}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [crate+ver] [crate+ver]"; exit 0 ; esac
# We convert the name-version seperator from '+' to '-' to
# avoid issues that may arise from version numbers that include
diff --git a/contrib/kiss-cargolock-urlgen b/contrib/kiss-cargolock-urlgen
index 372834d..7d78a6a 100755
--- a/contrib/kiss-cargolock-urlgen
+++ b/contrib/kiss-cargolock-urlgen
@@ -3,7 +3,7 @@
case "$1" in
-) set -- /dev/stdin ;;
- '') printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <Cargo.lock file>" "" \
+ ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <Cargo.lock file>" "" \
"'-' can be used to read from stdin." ; exit 0
esac
diff --git a/contrib/kiss-cat b/contrib/kiss-cat
index 5f5cf5d..937b46d 100755
--- a/contrib/kiss-cat
+++ b/contrib/kiss-cat
@@ -1,8 +1,8 @@
#!/bin/sh -e
# Concatanate package files in the installed package database
# File names are printed to stderr.
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[musage: %s <pkg> [file] [file]\n' "${0##*/}" ; exit 0; esac
-[ "$1" ] || { printf '\033[1;33m-> \033[musage: %s <pkg> [file] [file]\n' "${0##*/}" ; exit 1;}
kiss l "${pkg:=$1}" >/dev/null ; shift
for file in ${*:-build depends sources version} ; do
diff --git a/contrib/kiss-changelog b/contrib/kiss-changelog
index fd4daef..ed323d8 100755
--- a/contrib/kiss-changelog
+++ b/contrib/kiss-changelog
@@ -1,10 +1,7 @@
#!/bin/sh -e
# Print the git log of the specific package
-[ "$1" ] || {
- printf '\033[1;33m-> \033[musage: %s [pkg]\n' "${0##*/}"
- exit 0
-}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]"; exit 0; esac
kiss s "$1" >/dev/null
cd "$(kiss s "$1" | sed 1q)"
diff --git a/contrib/kiss-chbuild b/contrib/kiss-chbuild
index e478966..2b406d1 100755
--- a/contrib/kiss-chbuild
+++ b/contrib/kiss-chbuild
@@ -1,5 +1,6 @@
#!/bin/sh -e
# Create/destroy temporary chroots
+case "$1" in --help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/}"; exit 0; esac
log() { printf '\033[31;1m->\033[m %s.\n' "$@" ;}
diff --git a/contrib/kiss-chroot b/contrib/kiss-chroot
index b7430e8..9caa4cf 100755
--- a/contrib/kiss-chroot
+++ b/contrib/kiss-chroot
@@ -25,7 +25,7 @@ clean() {
}
main() {
- [ "$1" ] || usage
+ case "$1" in ''|--help|-h) usage; esac
[ -d "$1" ] || die Given path does not exist
[ "$(id -u)" = 0 ] || die Script needs to be run as root
diff --git a/contrib/kiss-depends b/contrib/kiss-depends
index f972e3f..0c1687e 100755
--- a/contrib/kiss-depends
+++ b/contrib/kiss-depends
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Display a package's dependencies
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
kiss l "$1" >/dev/null
cat "$KISS_ROOT/var/db/kiss/installed/$1/depends" 2>/dev/null
diff --git a/contrib/kiss-depends-finder b/contrib/kiss-depends-finder
index 91167a3..31320ed 100755
--- a/contrib/kiss-depends-finder
+++ b/contrib/kiss-depends-finder
@@ -1,7 +1,7 @@
#!/bin/sh -e
# Find missing dependencies by parsing 'ldd'
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
kiss l "$1" >/dev/null
@@ -31,7 +31,7 @@ while read -r file; do
# Skip listing these packages as dependencies.
case $pkg in
- musl|gcc|$1) ;;
+ musl|gcc|"$1") ;;
*) printf '%s\n' "$pkg" ;;
esac
done
diff --git a/contrib/kiss-export b/contrib/kiss-export
index 10dc3c1..82406aa 100755
--- a/contrib/kiss-export
+++ b/contrib/kiss-export
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Turn an installed package into a KISS tarball
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
kiss l "${1:-null}" >/dev/null
diff --git a/contrib/kiss-fork b/contrib/kiss-fork
index f450d26..c0fb99a 100755
--- a/contrib/kiss-fork
+++ b/contrib/kiss-fork
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Fork a package to the current directory
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
[ "$KISS_FORCE" ] || {
[ -d "$1" ] && {
printf '\033[1;31m!> \033[m%s\n' "$1 already exists on the current directory" \
diff --git a/contrib/kiss-link b/contrib/kiss-link
index f76caca..1f4b95c 100755
--- a/contrib/kiss-link
+++ b/contrib/kiss-link
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Link a forked package's files to the other repository
-[ "$1" ] || { printf '\033[1;33m-> \033[musage: kiss-link [file] [file]\n' ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[musage: kiss-link [file] [file]\n' ; exit 0 ; esac
# Check if the package exists in a repository and error out here
# if it does not. The error message from the package manager will
diff --git a/contrib/kiss-maintainer b/contrib/kiss-maintainer
index 1561754..da91420 100755
--- a/contrib/kiss-maintainer
+++ b/contrib/kiss-maintainer
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Find the maintainer of a package
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
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 84d2526..29c46ea 100755
--- a/contrib/kiss-manifest
+++ b/contrib/kiss-manifest
@@ -1,6 +1,6 @@
#!/bin/sh -ef
# Display all files owned by a package
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
kiss l "$1" >/dev/null
cat "$KISS_ROOT/var/db/kiss/installed/$1/manifest" 2>/dev/null
diff --git a/contrib/kiss-manifest-tree b/contrib/kiss-manifest-tree
index 1a9fffe..ac18b98 100755
--- a/contrib/kiss-manifest-tree
+++ b/contrib/kiss-manifest-tree
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Display all files owned by a package with a tree view
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} <pkg>" ; exit 0 ; esac
kiss l "$1" >/dev/null
printf '%s\n' "[$1]:"
tree -C --fromfile "$KISS_ROOT/var/db/kiss/installed/$1/manifest" | sed 1,2d
diff --git a/contrib/kiss-message b/contrib/kiss-message
index f29c8a5..8b82c86 100755
--- a/contrib/kiss-message
+++ b/contrib/kiss-message
@@ -1,10 +1,7 @@
#!/bin/sh
# Show messages from a package in the system database
-[ "$1" ] || {
- printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg] [pkg]"
- exit 0
-}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg] [pkg]"; exit 0; esac
for pkg do
# Apply basename stripping so a user could run
diff --git a/contrib/kiss-new b/contrib/kiss-new
index 491ce9c..6d41da9 100755
--- a/contrib/kiss-new
+++ b/contrib/kiss-new
@@ -4,11 +4,7 @@
out() { printf '\033[1;33m-> \033[m%s\n' "$@" >&2 ;}
die() { printf '\033[1;31m!> \033[m%s\n' "$@" >&2 ; exit 1 ;}
-[ "$1" ] || {
- out "usage: ${0##*/} <name> [version] [source]" \
- "Create boilerplate kiss packages"
- exit 0
-}
+case "$1" in ''|--help|-h) out "usage: ${0##*/} <name> [version] [source]"; exit 0; esac
[ -d "$1" ] && die "Package '$1' already exists."
diff --git a/contrib/kiss-orphans b/contrib/kiss-orphans
index d8f6776..7ffc939 100755
--- a/contrib/kiss-orphans
+++ b/contrib/kiss-orphans
@@ -1,6 +1,12 @@
#!/bin/sh -e
# List orphaned packages
+case "$1" in ''|--help|-h)
+ printf '\033[1;33m-> \033[m%s\n' \
+ "${0##*/}: lists packages that do not have any packages depending on them" >&2
+ exit 0
+esac
+
cd "$KISS_ROOT/var/db/kiss/installed/"
for pkg in *; do
@@ -12,6 +18,3 @@ for pkg in *; do
grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg"
done
-
-printf '\033[1;33m-> \033[m%s\n' "kiss-orphans: lists packages that do not" \
- "have any packages depending on them" >&2
diff --git a/contrib/kiss-owns b/contrib/kiss-owns
index 8745ed6..e3512d6 100755
--- a/contrib/kiss-owns
+++ b/contrib/kiss-owns
@@ -1,7 +1,7 @@
#!/bin/sh -e
# Check which package owns a file
-[ "$1" ] || { printf '%s\n' "usage: kiss-owns <file>" ; exit 1 ;}
+case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-owns <file>" ; exit 0 ; esac
# Strip 'KISS_ROOT' from the file path if passed and
# follow symlinks.
diff --git a/contrib/kiss-repodepends b/contrib/kiss-repodepends
index 5fad8d9..cbe7f43 100755
--- a/contrib/kiss-repodepends
+++ b/contrib/kiss-repodepends
@@ -1,7 +1,7 @@
#!/bin/sh -e
# Display a package's dependencies in the repository
-[ "$1" ] || { printf '%s\n' "usage: kiss-repodepends <pkg>" ; exit 1 ;}
+case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-repodepends <pkg>" ; exit 0 ; esac
kiss s "$1" >/dev/null
cat "$(kiss s "$1" | sed 1q)/depends" 2>/dev/null
diff --git a/contrib/kiss-reporevdepends b/contrib/kiss-reporevdepends
index 1a83c33..59262f0 100755
--- a/contrib/kiss-reporevdepends
+++ b/contrib/kiss-reporevdepends
@@ -2,10 +2,7 @@
# Display packages on the repository which depend on package
# shellcheck disable=2086
-[ "$1" ] || {
- printf 'usage: %s <pkg>\n' "${0##*/}"
- exit 1
-}
+case "$1" in ''|--help|-h) printf 'usage: %s <pkg>\n' "${0##*/}"; exit 0; esac
pkg="$1"
IFS=:; set -- $KISS_PATH; unset IFS
diff --git a/contrib/kiss-revdepends b/contrib/kiss-revdepends
index b2e18b3..05fa46d 100755
--- a/contrib/kiss-revdepends
+++ b/contrib/kiss-revdepends
@@ -1,7 +1,7 @@
#!/bin/sh -e
# Display packages which depend on package
-[ "$1" ] || { printf '%s\n' "usage: kiss-revdepends <pkg>" ; exit 1 ;}
+case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-revdepends <pkg>" ; exit 0 ; esac
kiss s "$1" >/dev/null
# 'cd' to the database directory as a simple way of
diff --git a/contrib/kiss-size b/contrib/kiss-size
index c5dc367..0a3e851 100755
--- a/contrib/kiss-size
+++ b/contrib/kiss-size
@@ -1,7 +1,7 @@
#!/bin/sh -ef
# Show the size on disk for a package
-[ "$1" ] || { printf '%s\n' "usage: kiss-size <pkg>" ; exit 1 ;}
+case "$1" in ''|--help|-h) printf '%s\n' "usage: kiss-size <pkg>" ; exit 0 ; esac
kiss s "$1" >/dev/null
# Filter directories from manifest and leave only files.
diff --git a/contrib/kiss-which b/contrib/kiss-which
index a82990d..1364e04 100755
--- a/contrib/kiss-which
+++ b/contrib/kiss-which
@@ -1,7 +1,7 @@
#!/bin/sh -e
# Locate the first instance of a KISS package
-[ "$1" ] || { printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 1 ;}
+case "$1" in ''|--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg]" ; exit 0; esac
{ kiss s "$1" || exit 1 ;} |
sed 1q