Make the storage functions more versatile.
This commit is contained in:
@@ -2,29 +2,33 @@
|
|||||||
|
|
||||||
function storage {
|
function storage {
|
||||||
location="$1"
|
location="$1"
|
||||||
quiet="$2"
|
style="$2"
|
||||||
|
|
||||||
if [[ -z $location ]]; then
|
if [[ -z $location ]]; then
|
||||||
echo "ERROR: Location must be passed. $location"
|
echo "ERROR: Location must be passed. $location"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$quiet" ]]; then
|
if [[ "$style" == "%" || "$style" == "pct" || "$style" == "percent" ]]; then
|
||||||
df -h $location | tail -n 1 | awk {print $5", "$3"/"$2""}
|
df -h $location | tail -n 1 | awk {print $5}
|
||||||
|
elif [[ "$style" == "/" || "$style" == "use" || "$style" == "usage" ]]
|
||||||
|
df -h $location | tail -n 1 | awk {print $3"/"$2}
|
||||||
else
|
else
|
||||||
df -h $location | tail -n 1 | awk {print $5" Free, "$3"/"$2" Used"}
|
df -h $location | tail -n 1 | awk {print $5" Free, "$3"/"$2" Used"}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export dwm_storage_style="usage"
|
||||||
|
|
||||||
function storage-root {
|
function storage-root {
|
||||||
storage / $1
|
storage / "$1"
|
||||||
}
|
}
|
||||||
function storage-root-dwm {
|
function storage-root-dwm {
|
||||||
storage-root q
|
storage-root "$dwm_storage_style"
|
||||||
}
|
}
|
||||||
|
|
||||||
function storage-home {
|
function storage-home {
|
||||||
storage /home $1
|
storage /home "$1"
|
||||||
}
|
}
|
||||||
function storage-home-dwm {
|
function storage-home-dwm {
|
||||||
storage-root q
|
storage-root "$dwm_storage_style"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user