blob: 8231ae1fb4a3f4fd0fe690990642777c5bdd762e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/bash
set -eu
function print_hr() {
local str cols
local start line end
str="${1:-}"
[[ -n $str ]] && str=" $str "
cols=$((${COLUMNS:-$(tput cols)} - ${#str} - 3))
# start=$'\e(0'; end=$'\e(B'; line="qqq"
start=''; end=''; line="─"
while ((${#line}<$cols)); do line+=$line; done
printf "╾"
printf "%s%s%s" "$start" "${line:0:$((cols/2))}" "$end"
printf "%s%s%s" "$start" "${line:0:$((cols/2))}" "$end"
printf "%s" "$str"
printf "%s%s%s" "$start" "${line:0:1}" "$end"
printf "╼"
printf "\n"
}
print_hr "$@"
|