plugins/base: rewrite `usage()`
Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.pull/1930/head
parent
5cb7522713
commit
c3f45b2ae7
|
|
@ -117,25 +117,18 @@ function banish-cookies ()
|
||||||
ln -s /dev/null ~/.macromedia
|
ln -s /dev/null ~/.macromedia
|
||||||
}
|
}
|
||||||
|
|
||||||
function usage ()
|
function usage() {
|
||||||
{
|
|
||||||
about 'disk usage per directory, in Mac OS X and Linux'
|
about 'disk usage per directory, in Mac OS X and Linux'
|
||||||
param '1: directory name'
|
param '1: directory name'
|
||||||
group 'base'
|
group 'base'
|
||||||
if [[ "$OSTYPE" == 'darwin'* ]]; then
|
case $OSTYPE in
|
||||||
if [ -n "$1" ]; then
|
*'darwin'*)
|
||||||
du -hd 1 "$1"
|
du -hd 1 "$@"
|
||||||
else
|
;;
|
||||||
du -hd 1
|
*'linux'*)
|
||||||
fi
|
du -h --max-depth=1 "$@"
|
||||||
|
;;
|
||||||
elif [[ "$OSTYPE" = 'linux'* ]]; then
|
esac
|
||||||
if [[ -n "$1" ]]; then
|
|
||||||
du -h --max-depth=1 "$1"
|
|
||||||
else
|
|
||||||
du -h --max-depth=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ ! -e "${BASH_IT}/plugins/enabled/todo.plugin.bash" \
|
if [[ ! -e "${BASH_IT}/plugins/enabled/todo.plugin.bash" \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue