summaryrefslogtreecommitdiff
path: root/manage
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-07-16 15:54:54 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-07-28 12:53:26 +0200
commit67e423edb25a3b565cd649a04ae73aa6446115d4 (patch)
tree405079ee7caa9a3fece445443db8721630a5a7dc /manage
parent7ee3dc9d74c845ad0c9cda52b300b7a4bb0da1c7 (diff)
[enh] CI - add shell script formatter
Implement rules and functions to format shell scripts: $ make format.shell or alternatively to format all source code: $ make format The formatter `shfmt` reads the rules from the editorconfig[1] If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags are given to the tool, no EditorConfig files will be used. [1] https://github.com/patrickvane/shfmt?tab=readme-ov-file#description Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'manage')
-rwxr-xr-xmanage15
1 files changed, 14 insertions, 1 deletions
diff --git a/manage b/manage
index 7d2305e65..df1c01c21 100755
--- a/manage
+++ b/manage
@@ -64,6 +64,12 @@ RST_FILES=(
'README.rst'
)
+SHFMT_SCRIPTS=(
+ "./manage"
+ "./container"
+ "./utils"
+)
+
help() {
nvm.help
cat <<EOF
@@ -90,6 +96,7 @@ pyenv.:
OK : test if virtualenv is OK
format.:
python : format Python code source using black
+ shell : format Shell scripts using shfmt
EOF
go.help
node.help
@@ -248,11 +255,17 @@ pyenv.uninstall() {
}
format.python() {
- build_msg TEST "[format.python] black \$BLACK_TARGETS"
+ build_msg TEST "[format.python] black ${BLACK_TARGETS[*]}"
pyenv.cmd black "${BLACK_OPTIONS[@]}" "${BLACK_TARGETS[@]}"
dump_return $?
}
+format.shell() {
+ build_msg TEST "[shfmt] shfmt ${SHFMT_SCRIPTS[*]}"
+ go.tool shfmt --list --write "${SHFMT_SCRIPTS[@]}"
+ dump_return $?
+}
+
docs.prebuild() {
build_msg DOCS "build ${DOCS_BUILD}/includes"
(