fastdu help was missing count -c

This commit is contained in:
q
2018-08-12 15:33:38 +03:00
parent f2a148f353
commit bcb605a9ca

View File

@@ -5,6 +5,7 @@ function helpexit() {
echo "Returns only the size as number" echo "Returns only the size as number"
echo " -h Human readable units" echo " -h Human readable units"
echo " -s Summary mode, otherwise each argument folder calculated separate" echo " -s Summary mode, otherwise each argument folder calculated separate"
echo " -c Count files instead of summarizing sizes"
echo " --help This help" echo " --help This help"
exit exit
} }
@@ -21,8 +22,8 @@ function filesize() {
split("B kB MB GB TB PB EB ZB",type) split("B kB MB GB TB PB EB ZB",type)
for(i=7;y < 1;i--) for(i=7;y < 1;i--)
y = x / (2^(10*i)) y = x / (2^(10*i))
str=int(y*10)/10 " " type[i+2] str=int(y*10)/10 " " type[i+2]
if (x==0) { str = "0 B" } if (i==-1) { str = x " B" }
print str print str
}' || return $? }' || return $?
} }
@@ -30,7 +31,7 @@ function siprefix() {
# Return a SI prefixed string from integer # Return a SI prefixed string from integer
[ "$1" = "0" ] && { [ "$1" = "0" ] && {
echo "0" echo "0 "
return 0 return 0
} }
@@ -38,9 +39,8 @@ function siprefix() {
split("_ k M G T P E Z",type) split("_ k M G T P E Z",type)
for(i=7;y < 1;i--) for(i=7;y < 1;i--)
y = x / (10^(3*i)) y = x / (10^(3*i))
str=int(y*10)/10 " " type[i+2] str=int(y*10)/10 " " type[i+2]
if (x==0) { str = "0" } if (i==-1) { str = x " " }
if (i==-1) { str = x }
print str print str
}' || return $? }' || return $?
} }
@@ -50,7 +50,7 @@ function processfolder() {
if [[ "$COUNT" -eq 1 ]]; then if [[ "$COUNT" -eq 1 ]]; then
countfiles "$@" countfiles "$@"
else else
displaysize "$@" displaysize "$@"
fi fi
} }
@@ -73,12 +73,12 @@ function displaysize() {
# Get options # Get options
what=() what=()
for (( i=1; i<=$#; i++ )); do for (( i=1; i<=$#; i++ )); do
[[ "${!i}" = "--help" ]] && helpexit [[ "${!i}" = "--help" ]] && helpexit
[[ "${!i}" = "-h" ]] && { HUMAN=1; continue; } [[ "${!i}" = "-h" ]] && { HUMAN=1; continue; }
[[ "${!i}" = "-c" ]] && { COUNT=1; continue; } [[ "${!i}" = "-c" ]] && { COUNT=1; continue; }
[[ "${!i}" = "-s" ]] && { SUMMARY=1; continue; } [[ "${!i}" = "-s" ]] && { SUMMARY=1; continue; }
what+=( "${!i}" ) what+=( "${!i}" )
done done
[[ -z "${what[@]}" ]] && what="." [[ -z "${what[@]}" ]] && what="."
# If only one entry, dont print the name # If only one entry, dont print the name
[[ "${#what[@]}" -eq 1 ]] && SUMMARY=1 [[ "${#what[@]}" -eq 1 ]] && SUMMARY=1