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
ba0c7e44
Commit
ba0c7e44
authored
Nov 06, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General: Cleanup info()
parent
39ef9207
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
neofetch
neofetch
+13
-16
No files found.
neofetch
View file @
ba0c7e44
...
@@ -2385,23 +2385,19 @@ info() {
...
@@ -2385,23 +2385,19 @@ info() {
subtitle="$1"
subtitle="$1"
# Call the function and update variable
# Call the function and update variable
if [ -z "$2" ]; then
"get${2:-$1}" 2>/dev/null
"get$1" 2>/dev/null
eval output="\$${2:-$1}"
eval output="\$${1}"
else
"get$2" 2>/dev/null
eval output="\$${2}"
fi
# Trim whitespace
# Trim whitespace
output="$(trim "$output")"
output="$(trim "$output")"
# If the output is empty, don'
t print anything
# If prin was used in the function, stop here.
if
[
-z
"
$output
"
]
;
then
[ "$prin" ] && \
err
"Info: Couldn't detect
$subtitle
"
unset prin && return
return
fi
# If the output is empty, don'
t print anything.
[
-z
"
$output
"
]
&&
\
err
"Info: Couldn't detect
$subtitle
"
&&
return
case
"
$1
"
in
case
"
$1
"
in
title
)
title
)
...
@@ -2410,9 +2406,7 @@ info() {
...
@@ -2410,9 +2406,7 @@ info() {
length
=
"
${#
output
}
"
length
=
"
${#
output
}
"
;;
;;
underline
)
underline
)
string
=
"
${
underline_color
}${
output
}
"
;;
string
=
"
${
underline_color
}${
output
}
"
;;
*
)
*
)
string
=
"
${
subtitle_color
}${
bold
}${
subtitle
}${
reset
}
"
string
=
"
${
subtitle_color
}${
bold
}${
subtitle
}${
reset
}
"
...
@@ -2469,6 +2463,9 @@ prin() {
...
@@ -2469,6 +2463,9 @@ prin() {
padding_num
=
"
${
padding
/\\033\[
}
"
padding_num
=
"
${
padding
/\\033\[
}
"
string
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
))
s"
"
$string
"
)
"
string
=
"
$(
printf
"%.
$((
columns
-
${
padding_num
/C
}
-
gap
))
s"
"
$string
"
)
"
fi
fi
# Tell info() that prin() was used.
prin
=
1
}
}
# }}}
# }}}
...
...
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