40 lines
828 B
Bash
40 lines
828 B
Bash
#!/bin/bash
|
|
|
|
#*************************#
|
|
# RELEASER:formatter #
|
|
#*************************#
|
|
# Designed & Developed by #
|
|
# Adrien Marquès #
|
|
# <xdrm-brackets> #
|
|
#*************************#
|
|
# git.xdrm.io #
|
|
#*************************#
|
|
|
|
S="12"
|
|
|
|
# (1) Creates a fixed inline progress
|
|
#--------------------------------------------------------#
|
|
set_inline_progress_size(){
|
|
test ! -z "$1" && test "`expr $1 + 0 2>/dev/null`" = "$1" && export S="$1"
|
|
}
|
|
|
|
inline_progress(){
|
|
|
|
# 1. init arguments
|
|
text=""
|
|
size="$S"
|
|
sep=" "
|
|
|
|
# 2. extract text
|
|
test ! -z "$1" && text="$1";
|
|
|
|
# 3. extract size
|
|
test ! -z "$2" && test "`expr $2 + 0 2>/dev/null`" = "$2" && size="$2";
|
|
|
|
# 4. Write text
|
|
len="`echo -n \"$text\" | wc -m`";
|
|
echo -n "$text";
|
|
for i in `seq $len $size`; do echo -n "$sep"; done;
|
|
|
|
return;
|
|
} |