Merge pull request #227 from dylanaraps/bar_changes

Made progress bars more customizable
This commit is contained in:
Dylan Araps 2016-04-24 20:36:11 +10:00
commit cda09a2ca9
3 changed files with 61 additions and 7 deletions

33
1.7.md
View file

@ -81,6 +81,7 @@ underline_enabled="on"
- Added KDE neon ascii art.
### Colors
- Fixed bug with `--colors` not working with all 256 terminal colors.
@ -91,3 +92,35 @@ underline_enabled="on"
would be white or black. This caused issues for those setting the foreground<br \>
color to red or etc. This change adds a new value for `--colors` and `colors=()`<br \>
called `fg` which will set the color to your foreground color.
### Progress Bars
- You can now enable/disable a border around the progress bars.
```sh
# $progress_border on
[=====-----]
# $progress_border off
=====-----
```
- You can now individually set the progress bar characters. This means that you can<br \>
have a seperate character for the elapsed and total portions of the bar.
```sh
# Examples with $progress_border on
# Elapsed: =
# Total: -
[=====-----]
# Elapsed: .
# Total: " "
[..... ]
# Elapsed: /
# Total: " "
[///// ]
```

View file

@ -250,8 +250,13 @@ prompt_height=1
# Progress bar character
# --progress_char char
progress_char="━"
# --progress_char elapsed_char total_char
progress_char_elapsed="-"
progress_char_total="="
# Progress vorder
# --progress_border on/off
progress_border="on"
# Progress bar length in spaces
# Number of chars long to make the progress bars.

View file

@ -275,8 +275,13 @@ prompt_height=1
# Progress bar character
# --progress_char char
progress_char="━"
# --progress_char elapsed_char total_char
progress_char_elapsed="="
progress_char_total="-"
# Progress vorder
# --progress_border on/off
progress_border="on"
# Progress bar length in spaces
# Number of chars long to make the progress bars.
@ -2561,8 +2566,15 @@ bar() {
total=$(printf %"$((progress_length - elapsed))"s)
# Set the colors and swap the spaces for $progress_char
bar="${progress_color_elapsed}${prog// /$progress_char}"
bar+="${progress_color_total}${total// /$progress_char}"
bar+="${progress_color_elapsed}${prog// /$progress_char_elapsed}"
bar+="${progress_color_total}${total// /$progress_char_total}"
# Borders
if [ "$progress_border" == "on" ]; then
bar+="$(color fg)]"
bar="$(color fg)[$bar"
fi
printf "%b%s\n" "${bar}${clear}"
}
@ -2796,7 +2808,11 @@ while [ "$1" ]; do
--block_width) block_width="$2" ;;
# Progress Bars
--progress_char) progress_char="$2" ;;
--progress_char)
progress_char_elapsed="$2"
progress_char_total="$3"
;;
--progress_border) progress_border="$2" ;;
--progress_length) progress_length="$2" ;;
--progress_colors)
progress_color_elapsed="$2"