Files
rustfs/scripts/makefile-header.sh
Ali Mehraji c7e2b4d8e7 Modular Makefile (#1288)
Signed-off-by: Ali Mehraji <a.mehraji75@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
2025-12-28 21:57:44 +08:00

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"