-
Notifications
You must be signed in to change notification settings - Fork 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre commit script to auto rustfmt (#1602)
* test pre-commit * remove pre-commit * first step * script to install precommit * use bash
- Loading branch information
1 parent
183fec3
commit 58d0ca2
Showing
3 changed files
with
23 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- repo: https://github.com/doublify/pre-commit-rust | ||
rev: master | ||
hooks: | ||
- id: fmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
echo "Copying rustfmt.toml into ~/.config/rustfmt/" | ||
mkdir -p "${HOME}"/.config/rustfmt | ||
cp $(dirname "${0}")/../rustfmt.toml "${HOME}"/.config/rustfmt/ | ||
|
||
if [[ ! -f "${HOME}/.local/bin/pre-commit" ]]; then | ||
echo "installing pre-commit program" | ||
if [[ ! -z "$(command -v pip3)" ]]; then | ||
pip3 install pre-commit | ||
elif [[ ! -z "$(command -v pip)" ]]; then | ||
pip install pre-commit | ||
else | ||
echo "Please install pip3 or pip and rerun this script" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
"${HOME}"/.local/bin/pre-commit install |
This file was deleted.
Oops, something went wrong.