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
d7e7e246
Commit
d7e7e246
authored
Dec 08, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shellcheck: Fix SC2068 and SC2086
parent
bfa43ff4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
neofetch
neofetch
+10
-9
No files found.
neofetch
View file @
d7e7e246
...
@@ -1588,11 +1588,11 @@ get_disk() {
...
@@ -1588,11 +1588,11 @@ get_disk() {
# df flags
# df flags
case
"
$os
"
in
case
"
$os
"
in
"Linux"
|
"iPhone OS"
|
"Windows"
|
"Solaris"
|
"GNU"
)
"Linux"
|
"iPhone OS"
|
"Windows"
|
"Solaris"
|
"GNU"
)
df_flags
=
"-h -l --total"
df_flags
=
(
-h
-l
--total
)
df_dir
=
"total"
df_dir
=
"total"
case
"
$distro
"
in
case
"
$distro
"
in
"OpenWRT"
*
)
df_flags
=
"-h"
;
df_dir
=
"rootfs"
;;
"OpenWRT"
*
)
df_flags
=
(
-h
)
;
df_dir
=
"rootfs"
;;
"Android"
*
)
return
;;
"Android"
*
)
return
;;
esac
esac
;;
;;
...
@@ -1600,7 +1600,7 @@ get_disk() {
...
@@ -1600,7 +1600,7 @@ get_disk() {
"Mac OS X"
|
"BSD"
|
"Haiku"
)
"Mac OS X"
|
"BSD"
|
"Haiku"
)
case
"
$distro
"
in
case
"
$distro
"
in
"FreeBSD"
*
|
*
"OS X"
*
|
"Mac"
*
)
"FreeBSD"
*
|
*
"OS X"
*
|
"Mac"
*
)
df_flags
=
"-l -H /"
df_flags
=
(
-l
-H
/
)
df_dir
=
"/"
df_dir
=
"/"
;;
;;
...
@@ -1610,7 +1610,7 @@ get_disk() {
...
@@ -1610,7 +1610,7 @@ get_disk() {
esac
esac
# Get the disk info
# Get the disk info
disk
=
"
$(
df
$df_flags
|
awk
-v
dir
=
"
$df_dir
"
'$0 ~ dir {print $2 ":" $3 ":" $5}'
)
"
disk
=
"
$(
df
"
${
df_flags
[@]
}
"
|
awk
-v
dir
=
"
$df_dir
"
'$0 ~ dir {print $2 ":" $3 ":" $5}'
)
"
# Format the output
# Format the output
disk_used
=
"
${
disk
#*
:
}
"
disk_used
=
"
${
disk
#*
:
}
"
...
@@ -2098,20 +2098,20 @@ get_term_size() {
...
@@ -2098,20 +2098,20 @@ get_term_size() {
# get the terminal size.
# get the terminal size.
if
[[
-n
"
$TMUX
"
]]
;
then
if
[[
-n
"
$TMUX
"
]]
;
then
printf
"%b"
"
\0
33Ptmux;
\0
33
\0
33[14t
\0
33
\0
33[c
\0
33
\\
"
printf
"%b"
"
\0
33Ptmux;
\0
33
\0
33[14t
\0
33
\0
33[c
\0
33
\\
"
read_flags
=
"-d c"
read_flags
=
(
-d
c
)
elif
[[
"
$image_program
"
==
"tycat"
]]
;
then
elif
[[
"
$image_program
"
==
"tycat"
]]
;
then
printf
"%b"
"
\0
33}qs
\0
00"
printf
"%b"
"
\0
33}qs
\0
00"
else
else
printf
"%b"
"
\0
33[14t
\0
33[c"
printf
"%b"
"
\0
33[14t
\0
33[c"
read_flags
=
"-d c"
read_flags
=
(
-d
c
)
fi
fi
# The escape codes above print the desired output as
# The escape codes above print the desired output as
# user input so we have to use read to store the out
# user input so we have to use read to store the out
# -put as a variable.
# -put as a variable.
builtin read
-s
-t
1
${
read_flags
}
-r
term_size
builtin read
-s
-t
1
"
${
read_flags
[@]
}
"
-r
term_size
# Split the string into height/width.
# Split the string into height/width.
if
[[
"
$image_program
"
==
"tycat"
]]
;
then
if
[[
"
$image_program
"
==
"tycat"
]]
;
then
...
@@ -2531,6 +2531,7 @@ trim() {
...
@@ -2531,6 +2531,7 @@ trim() {
# '
${
1
//[[
:space:]]/
}
' to remove newlines beofre we trim the whitespace.
# '
${
1
//[[
:space:]]/
}
' to remove newlines beofre we trim the whitespace.
set -f
set -f
# shellcheck disable=2086
builtin echo -E
${
1
//[[
:space:]]/
}
builtin echo -E
${
1
//[[
:space:]]/
}
set +f
set +f
}
}
...
@@ -2714,7 +2715,7 @@ get_distro_colors() {
...
@@ -2714,7 +2715,7 @@ get_distro_colors() {
# equal '
distro
'.
# equal '
distro
'.
if [[ "${ascii_colors[0]}" != "distro" ]]; then
if [[ "${ascii_colors[0]}" != "distro" ]]; then
color_text="off"
color_text="off"
set_colors
${ascii_colors[@]}
set_colors
"${ascii_colors[@]}"
fi
fi
}
}
...
@@ -2726,7 +2727,7 @@ set_colors() {
...
@@ -2726,7 +2727,7 @@ set_colors() {
c5="$(color "$5")${ascii_bold}"
c5="$(color "$5")${ascii_bold}"
c6="$(color "$6")${ascii_bold}"
c6="$(color "$6")${ascii_bold}"
[[ "$color_text" != "off" ]] && set_text_colors
$@
[[ "$color_text" != "off" ]] && set_text_colors
"$@"
}
}
set_text_colors() {
set_text_colors() {
...
...
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