aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.do7
-rwxr-xr-xsrc/cpt3
-rw-r--r--src/cpt-lib.in13
3 files changed, 16 insertions, 7 deletions
diff --git a/default.do b/default.do
index cb45cd0..23cedf8 100644
--- a/default.do
+++ b/default.do
@@ -1,8 +1,5 @@
. ./config.rc
-# Extensionless name of file
-fn="${1%.*}"
-
case "$1" in
all) redo-ifchange src/cpt-lib docs/all ;;
dist)
@@ -11,7 +8,9 @@ case "$1" in
;;
src/cpt-lib)
redo-ifchange "$1.in"
- sed "s|@VERSION@|$VERSION|g" < "$1.in" > "$3"
+ sed -e "s|@VERSION@|$VERSION|g" \
+ -e "s|@DOCSTRING@|Call functions from the library|g" < "$1.in" > "$3"
+ chmod +x "$3"
;;
"cpt-$VERSION.tar.xz")
redo docs/cpt.info
diff --git a/src/cpt b/src/cpt
index 57e16b4..c72d39d 100755
--- a/src/cpt
+++ b/src/cpt
@@ -16,9 +16,6 @@ case "$arg" in
done
for path; do
- # Ignore the library.
- [ lib = "$path" ] && continue
-
printf "%b->%b %-${max}s " "$colorb" "$colre" "${path#*/cpt-}"
sed -n 's/^# *//;2p' "$(command -v "cpt-$path")"
done | sort -uk1 >&2
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 34af54b..27ea686 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1,4 +1,5 @@
#!/bin/sh -ef
+# @DOCSTRING@
# shellcheck source=/dev/null
#
# This is the Carbs Packaging Toolchain written for Carbs Linux.
@@ -1912,3 +1913,15 @@ create_cache() {
fi
}
+
+# If the library is being called with its own name, run arguments.
+if [ "${0##*/}" = cpt-lib ]; then
+ pd() {
+ setup REST help:usage -- "usage: ${0##*/} [funcall...]"
+ global_options
+ }
+ eval "$(getoptions pd parse "$0")"
+ parse "$@"
+ eval set -- "$REST"
+ "$@"
+fi