Skip to content

Commit

Permalink
Create precommit.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
matolah committed Jul 9, 2023
1 parent 793574b commit 00eb498
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions precommit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/zsh

# Run extra steps when in Sourcetree or Tower (since they customize the PATH env var)
if [[ $PATH == *"Sourcetree"* || $PATH == *"Tower.app"* ]]; then
echo "We're in a Git GUI client. Since this Git client customizes the PATH env var, we need to fix the PATH."
echo "We're gonna fix the PATH by 'sourcing' the ~/.zshrc file:"
source ~/.zshrc
fi

SWIFTFORMAT=Pods/SwiftFormat/CommandLineTool/swiftformat

bundle exec git_stage_formatter --formatter \"$SWIFTFORMAT stdin --stdinpath '{}'\" \"*.swift\"

0 comments on commit 00eb498

Please sign in to comment.