diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bd9eccf..b15b8c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: - - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.5.1-1 + - repo: https://github.com/lovesegfault/beautysh + rev: v6.1.0 hooks: - - id: shfmt # requires Go to build + - id: beautysh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b1cbcb7..3338f23 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,18 +4,17 @@ Welcome to the Zap contributing guide. ## Development & CI -Auto formatted code with [`shfmt`](https://github.com/mvdan/sh#shfmt) is required for a pull request to be merged. +Auto formatted code with [`beautysh`](https://github.com/lovesegfault/beautysh) is required for a pull request to be merged. Format code: ```bash -shfmt -l -w . +beautysh ./*.zsh ``` ### pre-commit To add a formatting check on each commit [pre-commit](https://pre-commit.com/#intro) can be used. -shfmt via Go is required for pre-commit to work. Install `pre-commit`: diff --git a/install.sh b/install.sh index f42009b..56edd0b 100755 --- a/install.sh +++ b/install.sh @@ -13,11 +13,12 @@ main() { zshrc="${ZDOTDIR:-$HOME}/.zshrc" touch "$zshrc" - # shellcheck disable=SC2016 +# @formatter:off if ! grep -q '[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"' "$zshrc"; then sed -i.old '1 i\ [ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh"' "$zshrc" fi +# @formatter:on } main "$@" diff --git a/zap.zsh b/zap.zsh index 3bcc4e3..2336745 100644 --- a/zap.zsh +++ b/zap.zsh @@ -13,7 +13,7 @@ _try_source() { plugin_files_names=("$plugin_dir/$plugin_name.plugin.zsh" "$plugin_dir/$plugin_name.zsh" "$plugin_dir/$plugin_name.zsh-theme" - "$plugin_dir/${plugin_name#zsh-}.zsh") + "$plugin_dir/${plugin_name#zsh-}.zsh") for i in "${plugin_files_names[@]}"; do if [ -e "$i" ]; then source "$i"