mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 12:48:01 +00:00
d3d79bbe74
Skip additional call to `grep` and use Zsh native mechanism to detect GNU version of `du`. Further, Remove redundant `function` clause as per Prezto convention.
28 lines
557 B
Plaintext
28 lines
557 B
Plaintext
#
|
|
# Displays the grand total disk usage using human readable units.
|
|
#
|
|
# Authors:
|
|
# Suraj N. Kurapati <sunaku@gmail.com>
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
#
|
|
|
|
# function dut {
|
|
|
|
(( $# == 0 )) && set -- *
|
|
|
|
if [[ ${(@M)${(f)"$(du --version 2>&1)"}:#*GNU *} ]]; then
|
|
du -khsc "$@" | sort -h -r
|
|
else
|
|
local line size name
|
|
local -a record
|
|
|
|
while IFS=$'\n' read line; do
|
|
record=(${(z)line})
|
|
size="$(($record[1] / 1024.0))"
|
|
name="$record[2,-1]"
|
|
printf "%9.1LfM %s\n" "$size" "$name"
|
|
done < <(du -kcs "$@") | sort -n -r
|
|
fi
|
|
|
|
# }
|