Skip to content

Commit

Permalink
pyfmt: Fix parameter with old bash version
Browse files Browse the repository at this point in the history
Used to fail in bash 3.2 when called with --check
  • Loading branch information
def- committed Jan 4, 2024
1 parent 178f8b5 commit 44dd6f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/pyfmt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ cd "$(dirname "$0")/.."

try bin/pyactivate -m black . "$@"

args=("--fix")
arg="--fix"

while [[ $# -gt 0 ]]; do
case $1 in
--check)
# ruff only supports --fix, not --check
args=()
arg=""
shift
;;
*)
Expand All @@ -35,6 +35,9 @@ while [[ $# -gt 0 ]]; do
esac
done

try bin/pyactivate -m ruff "${args[@]}" --extend-exclude=misc/dbt-materialize .
try bin/pyactivate -m ruff --target-version=py38 "${args[@]}" misc/dbt-materialize
# We want empty arg to not do anything
# shellcheck disable=SC2086
try bin/pyactivate -m ruff $arg --extend-exclude=misc/dbt-materialize .
# shellcheck disable=SC2086
try bin/pyactivate -m ruff --target-version=py38 $arg misc/dbt-materialize
try_status_report

0 comments on commit 44dd6f3

Please sign in to comment.