Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
4a414135
Unverified
Commit
4a414135
authored
Dec 28, 2019
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disk: clean up
parent
d8a3ae5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
neofetch
neofetch
+22
-24
No files found.
neofetch
View file @
4a414135
...
@@ -3325,17 +3325,17 @@ END
...
@@ -3325,17 +3325,17 @@ END
}
}
get_disk() {
get_disk() {
type -p df &>/dev/null ||
\
type -p df &>/dev/null ||
{ err "Disk requires 'df' to function. Install 'df' to get disk info."; return; }
{ err "Disk requires 'df' to function. Install 'df' to get disk info."; return; }
df_version=
"$(df --version 2>&1)"
df_version=
$(df --version 2>&1)
case $df_version in
case $df_version in
*
"IMitv"
*) df_flags=(-P -g) ;; # AIX
*
IMitv
*) df_flags=(-P -g) ;; # AIX
*
"befhikm"
*) df_flags=(-P -k) ;; # IRIX
*
befhikm
*) df_flags=(-P -k) ;; # IRIX
*
"hiklnP"*) df_flags=(-h)
;; # OpenBSD
*
hiklnP*) df_flags=(-h)
;; # OpenBSD
*
"Tracker"
*) # Haiku
*
Tracker
*) # Haiku
err "Your version of df cannot be used due to the non-standard flags"
err "Your version of df cannot be used due to the non-standard flags"
return
return
;;
;;
...
@@ -3349,7 +3349,7 @@ get_disk() {
...
@@ -3349,7 +3349,7 @@ get_disk() {
unset "disks[0]"
unset "disks[0]"
# Stop here if 'df' fails to print disk info.
# Stop here if 'df' fails to print disk info.
[[
-z "${disks[*]}" ]] &&
{
[[
${disks[*]} ]] ||
{
err "Disk: df failed to print the disks, make sure the disk_show array is set properly."
err "Disk: df failed to print the disks, make sure the disk_show array is set properly."
return
return
}
}
...
@@ -3357,10 +3357,10 @@ get_disk() {
...
@@ -3357,10 +3357,10 @@ get_disk() {
for disk in "${disks[@]}"; do
for disk in "${disks[@]}"; do
# Create a second array and make each element split at whitespace this time.
# Create a second array and make each element split at whitespace this time.
IFS=" " read -ra disk_info <<< "$disk"
IFS=" " read -ra disk_info <<< "$disk"
disk_perc=
"${disk_info[4]/\%}"
disk_perc=
${disk_info[4]/\%}
case $df_version in
case $df_version in
*
"befhikm"
*)
*
befhikm
*)
disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024))G (${disk_perc}%)"
disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024))G (${disk_perc}%)"
;;
;;
...
@@ -3369,35 +3369,33 @@ get_disk() {
...
@@ -3369,35 +3369,33 @@ get_disk() {
;;
;;
esac
esac
# Subtitle.
case $disk_subtitle in
case $disk_subtitle in
"name"
)
name
)
disk_sub=
"${disk_info[0]}"
disk_sub=
${disk_info[0]}
;;
;;
"dir"
)
dir
)
disk_sub=
"${disk_info[5]/*\/}"
disk_sub=
${disk_info[5]/*\/}
disk_sub=
"${disk_sub:-${disk_info[5]}}"
disk_sub=
${disk_sub:-${disk_info[5]}}
;;
;;
*)
*)
disk_sub=
"${disk_info[5]}"
disk_sub=
${disk_info[5]}
;;
;;
esac
esac
# Bar.
case $disk_display in
case $disk_display in
"bar"
) disk="$(bar "$disk_perc" "100")" ;;
bar
) disk="$(bar "$disk_perc" "100")" ;;
"infobar"
) disk+=" $(bar "$disk_perc" "100")" ;;
infobar
) disk+=" $(bar "$disk_perc" "100")" ;;
"barinfo"
) disk="$(bar "$disk_perc" "100")${info_color} $disk" ;;
barinfo
) disk="$(bar "$disk_perc" "100")${info_color} $disk" ;;
"perc"
) disk="${disk_perc}% $(bar "$disk_perc" "100")" ;;
perc
) disk="${disk_perc}% $(bar "$disk_perc" "100")" ;;
esac
esac
# Append '(disk mount point)' to the subtitle.
# Append '(disk mount point)' to the subtitle.
if [[
-z
"$subtitle" ]]; then
if [[ "$subtitle" ]]; then
prin "$
{disk_sub}
" "$disk"
prin "$
subtitle ($disk_sub)
" "$disk"
else
else
prin "$
{subtitle} (${disk_sub})
" "$disk"
prin "$
disk_sub
" "$disk"
fi
fi
done
done
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment