mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 09:40:32 +00:00
Signed-off-by: Ali Mehraji <a.mehraji75@gmail.com> Co-authored-by: houseme <housemecn@gmail.com>
27 lines
615 B
Bash
Executable File
27 lines
615 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Total width of the whole line
|
|
WIDTH=100 # adjust if you want longer/shorter lines
|
|
|
|
print_heading() {
|
|
local title="$1"
|
|
local prefix="## —— "
|
|
local suffix=" "
|
|
local dash="-"
|
|
|
|
# length of the visible title block
|
|
local block_len=$(( ${#prefix} + ${#title} + ${#suffix} ))
|
|
|
|
# number of dashes needed
|
|
local dash_count=$(( WIDTH - block_len ))
|
|
|
|
# build dash line
|
|
local dashes
|
|
dashes=$(printf "%*s" "$dash_count" "" | tr ' ' "$dash")
|
|
|
|
# print the final heading
|
|
printf "%s%s%s%s\n" "$prefix" "$title" "$suffix" "$dashes"
|
|
}
|
|
|
|
print_heading "$1"
|