aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/cpt-manifest-tree2
-rwxr-xr-xcontrib/cpt-owns2
-rwxr-xr-xcontrib/cpt-reset24
3 files changed, 17 insertions, 11 deletions
diff --git a/contrib/cpt-manifest-tree b/contrib/cpt-manifest-tree
index 599c0bd..bc38bc2 100755
--- a/contrib/cpt-manifest-tree
+++ b/contrib/cpt-manifest-tree
@@ -21,4 +21,4 @@ case "$1" in
esac
cpt-list "$1" >/dev/null
printf '%s\n' "[$1]:"
-tree -C --fromfile "$CPT_ROOT/var/db/cpt/installed/$1/manifest" | sed 1,2d
+tree -C --fromfile "$CPT_ROOT/var/db/cpt/installed/$1/manifest" | sed 1d
diff --git a/contrib/cpt-owns b/contrib/cpt-owns
index 9bc7d77..1f362d7 100755
--- a/contrib/cpt-owns
+++ b/contrib/cpt-owns
@@ -40,7 +40,7 @@ case "$1" in
esac
# Strip 'CPT_ROOT' from the file path if passed and follow symlinks.
-file="${1#$CPT_ROOT}"
+file="${1#"$CPT_ROOT"}"
dirname=$(_readlinkf "$CPT_ROOT/${file%/*}")
file="$dirname/${file##*/}"
diff --git a/contrib/cpt-reset b/contrib/cpt-reset
index 2a1b66e..a2336e3 100755
--- a/contrib/cpt-reset
+++ b/contrib/cpt-reset
@@ -3,6 +3,7 @@
#
# Disable word-splittng warnings as they're safe here.
# shellcheck disable=SC2046
+# shellcheck source=../src/cpt-lib
## SYNOPSIS:
## .Nm
@@ -11,10 +12,10 @@
## removes all packages from the system that is not defined as a base package in
## .Pa /etc/cpt-base .
-[ "$1" ] && {
- printf 'usage: %s\n\nRemove all packages not defined in the base.\n' \
- "${0##*/}"
- exit 0
+parser_definition() {
+ setup REST help:usage -- "usage: ${0##*/}"
+ global_options compact
+ msg -- '' "Remove all packages outside of base definition"
}
. cpt-lib
@@ -27,9 +28,14 @@ set +f; for pkg in *; do
contains "$base" "$pkg" || set -- "$pkg" "$@"
done
-[ "$1" ] && {
- printf 'WARNING: This will remove \033[1m%s\033[m package(s).\n' "$#"
- printf 'Base packages can be redefined in %s\n' "$CPT_ROOT/etc/cpt-base"
- printf 'Continue? [Enter/Ctrl+C]\n'
- read -r _ && CPT_FORCE=1 cpt-remove "$@"
+[ -z "$1" ] && {
+ log "No package outside of the base definition could be found, not continuing."
+ exit 0
}
+
+warn "" "This is a potentially harmful operation, do NOT continue unless"
+warn "" "you know exactly what you are doing. Continuing will remove $#"
+warn "" "packages that are not listed in the base definition or that the"
+warn "" "base packages don't depend on. See the CPT BASE section on the"
+warn "" "user manual to learn more."
+prompt && cpt-remove "$@"