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
198d1e77
Commit
198d1e77
authored
Jan 28, 2017
by
Dylan Araps
Committed by
GitHub
Jan 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #648 from dylanaraps/strip
Prin: Fix underline not working
parents
4e3a9a1a
3d0ea7c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
travis
config/travis
+1
-1
neofetch
neofetch
+19
-5
No files found.
config/travis
View file @
198d1e77
...
@@ -39,7 +39,7 @@ print_info() {
...
@@ -39,7 +39,7 @@ print_info() {
info cols
info cols
info line_break
info line_break
# Testing
# Testing
.
prin
"prin"
prin
"prin"
prin
"prin"
"prin"
prin
"prin"
"prin"
...
...
neofetch
View file @
198d1e77
...
@@ -2543,11 +2543,9 @@ info() {
...
@@ -2543,11 +2543,9 @@ info() {
output="
$(
trim
"
${
!2
:-${
!1
}}
"
)
"
output="
$(
trim
"
${
!2
:-${
!1
}}
"
)
"
if [[ "
$2
" && "
${
output
//
}
" ]]; then
if [[ "
$2
" && "
${
output
//
}
" ]]; then
length="
$((${#
1
}
+
${#
output
}
+
2
))
"
prin "
$1
" "
$output
"
prin "
$1
" "
$output
"
elif [[ "
${
output
//
}
" ]]; then
elif [[ "
${
output
//
}
" ]]; then
[[ -z "
$length
" ]] && length="
${#
output
}
"
prin "
$output
"
prin "
$output
"
else
else
...
@@ -2560,14 +2558,20 @@ info() {
...
@@ -2560,14 +2558,20 @@ info() {
prin() {
prin() {
# If $2 doesn'
t
exist we format
$1
as info.
# If $2 doesn'
t
exist we format
$1
as info.
if [[
"
$(
trim
"
$1
"
)
"
&&
"
$2
"
]]; then
if [[
"
$(
trim
"
$1
"
)
"
&&
"
$2
"
]]; then
string=
"
${
1
//
$'
\0
33[0m'
}${
2
:+:
$2
}
"
string=
"
${
1
}${
2
:+:
$2
}
"
else
else
string=
"
${
2
:-
$1
}
"
string=
"
${
2
:-
$1
}
"
local subtitle_color=
"
$info_color
"
local subtitle_color=
"
$info_color
"
fi
fi
string=
"
$(
trim
"
${
string
//
$'
\0
33[0m'
}
"
)
"
# Log length if it doesn
't exist.
if [[ -z "$length" ]]; then
length="$(strip_sequences "$string")"
length="${#length}"
fi
# Format the output.
# Format the output.
string=
"
$(
trim
"
$string
"
)
"
string="${string/:/${reset}${colon_color}:${info_color}}"
string="${string/:/${reset}${colon_color}:${info_color}}"
string="${subtitle_color}${bold}${string}"
string="${subtitle_color}${bold}${string}"
...
@@ -2584,9 +2588,10 @@ prin() {
...
@@ -2584,9 +2588,10 @@ prin() {
get_underline() {
get_underline() {
if [[ "$underline_enabled" == "on" ]]; then
if [[ "$underline_enabled" == "on" ]]; then
printf -v underline "%${length}s"
printf -v underline "%${length}s"
underline="
${
underline_color
}${
underline
// /
$underline_char
}
"
printf "%b\n" "${text_padding:+\033[${text_padding}C}${zws}${underline_color}${underline// /$underline_char}${reset}
"
unset -v length
unset -v length
fi
fi
prin=1
}
}
get_line_break() {
get_line_break() {
...
@@ -2635,6 +2640,15 @@ trim_quotes() {
...
@@ -2635,6 +2640,15 @@ trim_quotes() {
printf
"%s"
"
$trim_output
"
printf
"%s"
"
$trim_output
"
}
}
strip_sequences() {
strip="
${
1
//
$'
\0
33['
3
[0-9]m
}
"
strip="
${
strip
//
$'
\0
33['
38
\;5\;[0-9]m
}
"
strip="
${
strip
//
$'
\0
33['
38
\;5\;[0-9][0-9]m
}
"
strip="
${
strip
//
$'
\0
33['
38
\;5\;[0-9][0-9][0-9]m
}
"
printf "
%s
\n
" "
$strip
"
}
uppercase() {
uppercase() {
((bash_version >= 4)) && printf "
%s
" "
${
1
^
}
"
((bash_version >= 4)) && printf "
%s
" "
${
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