drone/init_docsy.sh

35 lines
807 B
Bash
Executable File

#!/bin/bash
#
# Helper functions
#
declare -i term_width=120
h1() {
declare border padding text
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
text="\\e[1m$*\\e[0m"
echo -e "$border"
echo -e "${padding}${text}${padding}"
echo -e "$border"
}
h2() {
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
}
h1 "Inicjalizacja struktury hugo"
hugo new site --force ./
h1 "Inicjalizacja repozytorium git"
git init
h2 "Inicjalizacja submodułu z docsy"
git submodule add https://github.com/google/docsy.git themes/docsy
echo 'theme = "docsy"' >> config.toml
git submodule update --init --recursive
h1 "Obsłga mermaid"
mv tmp_layouts layouts
h1 "Czyszczenie repozytorium"
rm init_docsy.sh