Disk: [macOS] Use -P
This commit is contained in:
parent
265e14b151
commit
868d8c2d8e
18
neofetch
18
neofetch
|
@ -1539,20 +1539,20 @@ get_term_font() {
|
||||||
get_disk() {
|
get_disk() {
|
||||||
type -p df >/dev/null 2>&1 || { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; }
|
type -p df >/dev/null 2>&1 || { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; }
|
||||||
|
|
||||||
# Get the info for /
|
|
||||||
disks=($(df -h /)) || { err "Disk: 'df' exited with error code 1"; return; }
|
|
||||||
|
|
||||||
# Split the info
|
# Split the info
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Haiku") return ;;
|
"Haiku") return ;;
|
||||||
"Mac OS X") ;;
|
"Mac OS X") df_flags=(-P -h /) ;;
|
||||||
*)
|
*) df_flags=(-h /) ;;
|
||||||
disk_used="${disks[9]}"
|
|
||||||
disk_total="${disks[8]}"
|
|
||||||
disk_total_per="(${disks[11]})"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Get the info for /
|
||||||
|
disks=($(df "${df_flags[@]}")) || { err "Disk: 'df' exited with error code 1"; return; }
|
||||||
|
|
||||||
|
disk_used="${disks[9]}"
|
||||||
|
disk_total="${disks[8]}"
|
||||||
|
disk_total_per="(${disks[11]})"
|
||||||
|
|
||||||
# Put it all together
|
# Put it all together
|
||||||
disk="${disk_used} / ${disk_total} ${disk_total_per}"
|
disk="${disk_used} / ${disk_total} ${disk_total_per}"
|
||||||
|
|
||||||
|
|
Reference in New Issue