From b61b58ce2c1371d6f904f108fa7feed3abfbe5c7 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Wed, 8 Apr 2026 13:18:14 +0900 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- bin/hr | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/hr (limited to 'bin/hr') diff --git a/bin/hr b/bin/hr new file mode 100755 index 0000000..8231ae1 --- /dev/null +++ b/bin/hr @@ -0,0 +1,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 "$@" -- cgit 1.4.1