Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dim colors of status message when counts are zero #286

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/share/poudriere/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,14 @@ show_log_info() {
return 0
}

show_colored_count() {
if [ $4 -gt 0 ]; then
printf "${1}${2}: %-${3}d" ${4}
else
printf "${COLOR_LIGHT_GRAY}${2}: %-${3}d" ${4}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be COLOR_COUNT_ZERO or COLOR_DIMMED or something and then default it to COLOR_LIGHT_GRAY in src/share/poudriere/include/colors.sh. That's so a user can change the color without changing what "gray" means.

fi
}

show_build_summary() {
local status nbb nbf nbs nbi nbq ndone nbtobuild buildname
local log now elapsed buildtime queue_width
Expand Down Expand Up @@ -797,8 +805,14 @@ show_build_summary() {
elapsed=${_elapsed_time}
calculate_duration buildtime ${elapsed}

printf "[${MASTERNAME}] [${buildname}] [${status}] Queued: %-${queue_width}d ${COLOR_SUCCESS}Built: %-${queue_width}d ${COLOR_FAIL}Failed: %-${queue_width}d ${COLOR_SKIP}Skipped: %-${queue_width}d ${COLOR_IGNORE}Ignored: %-${queue_width}d${COLOR_RESET} Tobuild: %-${queue_width}d Time: %s\n" \
${nbq} ${nbb} ${nbf} ${nbs} ${nbi} ${nbtobuild} "${buildtime}"
printf "[${MASTERNAME}] [${buildname}] [${status}] %s %s %s %s %s %s${COLOR_RESET} Time: %s\n" \
"$(show_colored_count ${COLOR_BLACK} 'Queued' ${queue_width} ${nbq})" \
"$(show_colored_count ${COLOR_SUCCESS} 'Built' ${queue_width} ${nbb})" \
"$(show_colored_count ${COLOR_FAIL} 'Failed' ${queue_width} ${nbf})" \
"$(show_colored_count ${COLOR_SKIP} 'Skipped' ${queue_width} ${nbs})" \
"$(show_colored_count ${COLOR_IGNORE} 'Ignored' ${queue_width} ${nbi})" \
"$(show_colored_count ${COLOR_BLACK} 'Tobuild' ${queue_width} ${nbtobuild})" \
"${buildtime}"
}

siginfo_handler() {
Expand Down