mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-16 17:20:33 +00:00
Modular Makefile (#1288)
Signed-off-by: Ali Mehraji <a.mehraji75@gmail.com> Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
26
scripts/makefile-header.sh
Executable file
26
scripts/makefile-header.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user