From 07a3b7821a3398e32eb7691c7320906ffafee29d Mon Sep 17 00:00:00 2001 From: Aleksander Cynarski Date: Tue, 1 Sep 2020 18:08:20 +0200 Subject: [PATCH] init --- init_docsy.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/init_docsy.sh b/init_docsy.sh index ca4b1f6..1df4c13 100755 --- a/init_docsy.sh +++ b/init_docsy.sh @@ -1,9 +1,32 @@ #!/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 "Czyszczenie repozytorium" rm init_docsy.sh