Add automatic, configured formatting.
parent
1c941e71e7
commit
63e5acc91f
|
@ -0,0 +1,6 @@
|
|||
BasedOnStyle: LLVM
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
ContinuationIndentWidth: 2
|
||||
IndentWidth: 2
|
4
.envrc
4
.envrc
|
@ -1,3 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if command -v git > /dev/null && on_git_branch; then
|
||||
git config --local core.hooksPath .githooks/
|
||||
fi
|
||||
|
||||
use flake
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
filesToFormat=$(
|
||||
git --no-pager diff --name-status --no-color --cached | \
|
||||
awk '$1 != "D" && $2 ~ /\.c\|\.h/ {print $NF}'
|
||||
)
|
||||
|
||||
for path in $filesToFormat
|
||||
do
|
||||
clang-format -i "$path"
|
||||
git add "$path"
|
||||
done;
|
16
README.md
16
README.md
|
@ -26,3 +26,19 @@ include:
|
|||
Once all prompts are evaluated, the keys of the object are converted into
|
||||
uppercase environment variables and passed to the `run.sh` file relative to the
|
||||
current directory.
|
||||
|
||||
## Development
|
||||
|
||||
This template includes an `.envrc` file for use with [direnv](https://direnv.net/).
|
||||
|
||||
### Formatting
|
||||
|
||||
A `pre-commit` file is included in `.githooks` to ensure consistent formatting.
|
||||
Run the following to configure `git` to use it:
|
||||
|
||||
```bash
|
||||
git config --local core.hooksPath .githooks/
|
||||
```
|
||||
|
||||
If running [direnv](https://direnv.net/), this is done automatically provided
|
||||
`git` is installed and a repository is initialized.
|
||||
|
|
Loading…
Reference in New Issue