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
f855ae24
Commit
f855ae24
authored
Jun 12, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move all whitespace trimming to an external function
parent
f18c3156
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
23 deletions
+16
-23
neofetch
neofetch
+16
-23
No files found.
neofetch
View file @
f855ae24
...
@@ -480,7 +480,6 @@ getdistro () {
...
@@ -480,7 +480,6 @@ getdistro () {
"Linux"
)
"Linux"
)
if
type
-p
lsb_release
>
/dev/null 2>&1
;
then
if
type
-p
lsb_release
>
/dev/null 2>&1
;
then
distro
=
"
$(
lsb_release
-d
2>/dev/null |
awk
-F
':'
'/Description/ {printf $2}'
)
"
distro
=
"
$(
lsb_release
-d
2>/dev/null |
awk
-F
':'
'/Description/ {printf $2}'
)
"
distro
=
${
distro
/[[
:space:]]
}
elif
type
-p
crux
>
/dev/null 2>&1
;
then
elif
type
-p
crux
>
/dev/null 2>&1
;
then
distro
=
"
$(
crux
)
"
distro
=
"
$(
crux
)
"
...
@@ -533,12 +532,9 @@ getdistro () {
...
@@ -533,12 +532,9 @@ getdistro () {
# Strip crap from the output of wmic
# Strip crap from the output of wmic
distro=
${
distro
/Caption
'='
}
distro=
${
distro
/Caption
'='
}
distro=
${
distro
//[[
:space:]]/
}
distro=
${
distro
//
}
distro=
${
distro
/Microsoft
}
distro=
${
distro
/Microsoft
}
;;
;;
esac
esac
distro="
${
distro
%
"
${
distro
##*[![
:space:]]
}
"
}
"
# Get architecture
# Get architecture
[ "
$os_arch
" == "
on
" ] &&
\
[ "
$os_arch
" == "
on
" ] &&
\
...
@@ -646,7 +642,6 @@ getuptime () {
...
@@ -646,7 +642,6 @@ getuptime () {
uptime=
${
uptime
/minutes/mins
}
uptime=
${
uptime
/minutes/mins
}
uptime=
${
uptime
/minute/min
}
uptime=
${
uptime
/minute/min
}
uptime=
${
uptime
/seconds/secs
}
uptime=
${
uptime
/seconds/secs
}
uptime=
${
uptime
#
}
;;
;;
"
tiny
")
"
tiny
")
...
@@ -659,10 +654,8 @@ getuptime () {
...
@@ -659,10 +654,8 @@ getuptime () {
uptime=
${
uptime
/ minute/m
}
uptime=
${
uptime
/ minute/m
}
uptime=
${
uptime
/ seconds/s
}
uptime=
${
uptime
/ seconds/s
}
uptime=
${
uptime
/,
}
uptime=
${
uptime
/,
}
uptime=
${
uptime
#
}
;;
;;
esac
esac
uptime=
${
uptime
//+( )/
}
}
}
# }}}
# }}}
...
@@ -743,7 +736,6 @@ getpackages () {
...
@@ -743,7 +736,6 @@ getpackages () {
packages
=
$((
packages+
=
$(
ls
-1
/cygdrive/c/ProgramData/chocolatey/lib |
wc
-l
)))
packages
=
$((
packages+
=
$(
ls
-1
/cygdrive/c/ProgramData/chocolatey/lib |
wc
-l
)))
;;
;;
esac
esac
packages
=
${
packages
//
}
}
}
# }}}
# }}}
...
@@ -784,8 +776,6 @@ getshell () {
...
@@ -784,8 +776,6 @@ getshell () {
shell+
=
"
$(
"
$SHELL
"
-c
'printf "%s" "$FISH_VERSION"'
)
"
shell+
=
"
$(
"
$SHELL
"
-c
'printf "%s" "$FISH_VERSION"'
)
"
;;
;;
esac
esac
shell
=
"
${
shell
/\(*\)
}
"
fi
fi
}
}
...
@@ -1180,9 +1170,6 @@ getcpu () {
...
@@ -1180,9 +1170,6 @@ getcpu () {
;;
;;
esac
esac
# Trim whitespace
cpu=
${
cpu
//+( )/
}
[ ! -z "
$cpu
" ] && prin "
$subtitle
" "
$cpu
"
[ ! -z "
$cpu
" ] && prin "
$subtitle
" "
$cpu
"
if [ "
$cpu_display
" != "
off
" ]; then
if [ "
$cpu_display
" != "
off
" ]; then
...
@@ -1219,7 +1206,6 @@ getgpu () {
...
@@ -1219,7 +1206,6 @@ getgpu () {
count="
$(
printf
"%s"
"
$gpu
"
|
uniq
-c
)
"
count="
$(
printf
"%s"
"
$gpu
"
|
uniq
-c
)
"
count=
${
count
/ VGA*
}
count=
${
count
/ VGA*
}
count=
${
count
/ 3D*
}
count=
${
count
/ 3D*
}
count=
${
count
//[[
:space:]]
}
# If there's more than one gpu
# If there's more than one gpu
# Display the count.
# Display the count.
...
@@ -1366,8 +1352,6 @@ getgpu () {
...
@@ -1366,8 +1352,6 @@ getgpu () {
"Windows")
"Windows")
gpu=$(wmic path Win32_VideoController get caption /value)
gpu=$(wmic path Win32_VideoController get caption /value)
gpu=${gpu/Caption'
=
'}
gpu=${gpu/Caption'
=
'}
gpu=${gpu//[[:space:]]/ }
gpu=${gpu// }
;;
;;
esac
esac
...
@@ -1393,7 +1377,6 @@ getgpu () {
...
@@ -1393,7 +1377,6 @@ getgpu () {
;;
;;
esac
esac
gpu=${gpu//+( )/ }
gpu="${gpu}${count}"
gpu="${gpu}${count}"
}
}
...
@@ -1560,11 +1543,9 @@ getresolution () {
...
@@ -1560,11 +1543,9 @@ getresolution () {
"
Windows
")
"
Windows
")
width=
$(
wmic path Win32_VideoController get CurrentHorizontalResolution /value 2>/dev/null
)
width=
$(
wmic path Win32_VideoController get CurrentHorizontalResolution /value 2>/dev/null
)
width=
${
width
/CurrentHorizontalResolution
'='
/
}
width=
${
width
/CurrentHorizontalResolution
'='
/
}
width=
${
width
//[[
:space:]]
}
height=
$(
wmic path Win32_VideoController get CurrentVerticalResolution /value 2>/dev/null
)
height=
$(
wmic path Win32_VideoController get CurrentVerticalResolution /value 2>/dev/null
)
height=
${
height
/CurrentVerticalResolution
'='
/
}
height=
${
height
/CurrentVerticalResolution
'='
/
}
height=
${
height
//[[
:space:]]
}
[ ! -z "
$width
" ] &&
\
[ ! -z "
$width
" ] &&
\
resolution="
${
width
}
x
${
height
}
"
resolution="
${
width
}
x
${
height
}
"
...
@@ -1693,7 +1674,6 @@ getstyle () {
...
@@ -1693,7 +1674,6 @@ getstyle () {
gtk3theme=${gtk3theme/${name}*=}
gtk3theme=${gtk3theme/${name}*=}
gtk3theme=${gtk3theme//\"}
gtk3theme=${gtk3theme//\"}
gtk3theme=${gtk3theme/[[:space:]]/ }
fi
fi
# Uppercase the first letter of each gtk theme
# Uppercase the first letter of each gtk theme
...
@@ -1723,7 +1703,6 @@ getstyle () {
...
@@ -1723,7 +1703,6 @@ getstyle () {
theme="${gtk2theme}${gtk3theme}"
theme="${gtk2theme}${gtk3theme}"
theme=${theme//\"}
theme=${theme//\"}
theme=${theme//\'
}
theme=${theme//\'
}
theme=
${
theme
// /
}
# Make the output shorter by removing "
[GTKX]
" from the string
# Make the output shorter by removing "
[GTKX]
" from the string
if [ "
$gtk_shorthand
" == "
on
" ]; then
if [ "
$gtk_shorthand
" == "
on
" ]; then
...
@@ -1958,8 +1937,6 @@ getbattery () {
...
@@ -1958,8 +1937,6 @@ getbattery () {
"
Windows
")
"
Windows
")
battery="
$(
wmic Path Win32_Battery get EstimatedChargeRemaining /value
)
"
battery="
$(
wmic Path Win32_Battery get EstimatedChargeRemaining /value
)
"
battery=
${
battery
/EstimatedChargeRemaining
'='
}
battery=
${
battery
/EstimatedChargeRemaining
'='
}
battery=
${
battery
//[[
:space:]]/
}
battery=
${
battery
//
}
[ ! -z "
$battery
" ] &&
\
[ ! -z "
$battery
" ] &&
\
battery+="
%
"
battery+="
%
"
;;
;;
...
@@ -2496,6 +2473,9 @@ info () {
...
@@ -2496,6 +2473,9 @@ info () {
# If the output is empty, don't print anything
# If the output is empty, don't print anything
[
-
z
"
$output
"
]
&&
return
[
-
z
"
$output
"
]
&&
return
# Trim whitespace
output
=
"
$(
trim
"
$output
"
)
"
case
"
$1
"
in
case
"
$1
"
in
title
)
title
)
string
=
"
${
title_color
}${
bold
}${
output
}
"
string
=
"
${
title_color
}${
bold
}${
output
}
"
...
@@ -2536,6 +2516,9 @@ prin () {
...
@@ -2536,6 +2516,9 @@ prin () {
length
=
$((${#
subtitle
}
+
${#
2
}
+
1
))
length
=
$((${#
subtitle
}
+
${#
2
}
+
1
))
fi
fi
# Trim whitespace
string
=
"
$(
trim
"
$string
"
)
"
# Print the info
# Print the info
printf
"%b%s
\n
"
"
${
padding
}${
string
}
\0
33[0m"
printf
"%b%s
\n
"
"
${
padding
}${
string
}
\0
33[0m"
}
}
...
@@ -2803,6 +2786,16 @@ getlinebreak () {
...
@@ -2803,6 +2786,16 @@ getlinebreak () {
# }}}
# }}}
# Trim whitespace {{{
trim
()
{
set
-
f
builtin echo
-
E
$1
set
+
f
}
# }}}
# }}}
# }}}
...
...
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