diff options
author | merakor <cem@ckyln.com> | 2020-09-05 09:17:13 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-09-05 09:17:13 +0000 |
commit | 5416e51a84066536701d503163512c2f5616d23b (patch) | |
tree | bae7c8d21d02f0849b8067942245683b95075eb0 /contrib/cpt-size | |
parent | 26e3b92dce26631a6783eb430326d37a93e62488 (diff) | |
download | cpt-5416e51a84066536701d503163512c2f5616d23b.tar.gz |
cpt-size: set files as the main arguments
So that we can use "$@"
FossilOrigin-Name: 8c113f776cd199f51741d60ef15a6c34b3c637ab8b4043e189ffe6aca3dcfa64
Diffstat (limited to 'contrib/cpt-size')
-rwxr-xr-x | contrib/cpt-size | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/cpt-size b/contrib/cpt-size index 456fa25..f55f72a 100755 --- a/contrib/cpt-size +++ b/contrib/cpt-size @@ -11,12 +11,14 @@ esac cpt-search "$1" >/dev/null -# Filter directories from manifest and leave only files. -# Directories in the manifest end in a trailing '/'. -files=$(sed 's|.*/$||' "$CPT_ROOT/var/db/cpt/installed/$1/manifest") +files= +while read -r file; do + # Filter directories from manifest and leave only files. + # Directories in the manifest end in a trailing '/'. + case $file in */) continue; esac + files="$files '$file'" +done < "$CPT_ROOT/var/db/cpt/installed/$1/manifest" +eval "set -- $files" # Send the file list to 'du'. -# This unquoted variable is safe as word splitting is intended -# and globbing is globally disabled in this script. -# shellcheck disable=2086 -du -shc -- $files 2>/dev/null +du -shc -- "$@" 2>/dev/null |