aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-09-20 12:16:14 +0000
committermerakor <cem@ckyln.com>2021-09-20 12:16:14 +0000
commitd92e98b16aa253976c697afa3f1ecfcf9960df5f (patch)
tree357f0bd5048af14af3e7d8462aae65df8ff681f7
parent529cfc136e08df98acf670037d77266d02761507 (diff)
downloadcpt-d92e98b16aa253976c697afa3f1ecfcf9960df5f.tar.gz
cpt-size: fix crux-like usage
FossilOrigin-Name: 5408c96aa1eb3f800a9c03e106dd583f06031d8716e1952bd42284cad605a758
-rwxr-xr-xcontrib/cpt-size8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/cpt-size b/contrib/cpt-size
index 4b983a1..00508b8 100755
--- a/contrib/cpt-size
+++ b/contrib/cpt-size
@@ -10,7 +10,10 @@
## calculates the sizes of given
## .Ar packages
## using the files from the package manifest and outputs a total size of the
-## packages along with all the files associated with them.
+## packages along with all the files associated with them. If no arguments have
+## been given,
+## .Nm
+## will use the name of the current directory as an argument.
parser_definition() {
setup REST help:usage -- "usage: ${0##*/} [pkg...]"
disp :usage -h --help hidden:1
@@ -20,6 +23,9 @@ parser_definition() {
# shellcheck disable=1091
. cpt-lib
+# Use the current directory if no arguments have been given.
+[ "$1" ] || set -- "${PWD##*/}"
+
# Ensure that all the packages given as arguments are installed.
pkg_list "$@" >/dev/null