From 9942a0772cb49ddae78890b9638afea98d591c02 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Wed, 7 Oct 2026 15:46:17 +0100 Subject: [PATCH 1/3] add a makefile with a format target --- Makefile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ab3601 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +SHELL=/bin/bash +.DEFAULT_GOAL := help + +SHELL_SOURCES = bin/dev* + + +# ------------------------------- +# Common targets for Dev projects +# ------------------------------- +# +# Edit these targets so they work as expected on the current project. +# +# Remember there may be other tools which use these targets, so if a target is not suitable for +# the current project, then keep the target and simply make it do nothing. + +help: ## This help dialog. +help: + @awk '/^[\-[:alnum:]]*: ##/ { split($$0, x, "##"); printf "%20s%s\n", x[1], x[2]; }' $(MAKEFILE_LIST) + +install-local: ## Install the tools needed to work on this project. +install-local: + brew install shfmt + +format: ## Run this project's code formatters. +format: + shfmt --indent 4 --write $(SHELL_SOURCES) From f1ba6f76200c7cbdc995c992fa105d0752ef8e31 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Wed, 7 Oct 2026 15:46:17 +0100 Subject: [PATCH 2/3] format the scripts with shfmt --- bin/dev-clone | 3 +-- bin/dev-unlock-server | 2 +- bin/dev-update-aws-config | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/dev-clone b/bin/dev-clone index ef76701..89435b8 100755 --- a/bin/dev-clone +++ b/bin/dev-clone @@ -42,8 +42,7 @@ git clone "$GIT_URI" . # mkproject fails with super strict mode - so we need to allow unbound variables at this point set +u -if grep --fixed-strings --silent "basepython" tox.ini; -then +if grep --fixed-strings --silent "basepython" tox.ini; then PYTHON_VERSION=$(sed -e 's/basepython[[:space:]]=[[:space:]]//' -e 'tx' -e 'd' -e ':x' tox.ini | head -n 1) PYTHON_VERSION_NUMBER=${PYTHON_VERSION/python/} LATEST_PYTHON=$(pyenv latest "$PYTHON_VERSION_NUMBER") diff --git a/bin/dev-unlock-server b/bin/dev-unlock-server index 4be6326..3296680 100755 --- a/bin/dev-unlock-server +++ b/bin/dev-unlock-server @@ -9,7 +9,7 @@ fi HOST="$1" LUKS_PASSPHRASE=$(op read "op://aizi3l3vxjc52mboshwj7bbytq/$HOST/password") -echo -n "$LUKS_PASSPHRASE" | \ +echo -n "$LUKS_PASSPHRASE" | ssh -o UserKnownHostsFile="$HOME/.ssh/known_hosts.cryptroot-unlock" \ -o StrictHostKeyChecking=accept-new \ -o BatchMode=yes \ diff --git a/bin/dev-update-aws-config b/bin/dev-update-aws-config index bd29fcb..a42cfed 100755 --- a/bin/dev-update-aws-config +++ b/bin/dev-update-aws-config @@ -17,6 +17,6 @@ if [ -f ~/.aws/config ]; then mv ~/.aws/config "$HOME/.aws/config.old.$OLD_TIMESTAMP" fi -op read "op://Shared/AWS Config Template/notesPlain" | sed -e "s|USERNAME|$CONFIG_USERNAME|g" > ~/.aws/config +op read "op://Shared/AWS Config Template/notesPlain" | sed -e "s|USERNAME|$CONFIG_USERNAME|g" >~/.aws/config echo "Config file updated!" From 91414574e2b3cca83c86ec81ddd19d0cd5d81704 Mon Sep 17 00:00:00 2001 From: Kyle Stevenson Date: Mon, 26 Oct 2026 10:52:37 +0000 Subject: [PATCH 3/3] move shfmt settings into an editorconfig --- .editorconfig | 12 ++++++++++++ Makefile | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1e34466 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[[shell]] +indent_style = space +indent_size = 4 +switch_case_indent = true diff --git a/Makefile b/Makefile index 2ab3601..e7e80ca 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,4 @@ install-local: format: ## Run this project's code formatters. format: - shfmt --indent 4 --write $(SHELL_SOURCES) + shfmt --write $(SHELL_SOURCES)