From 472aaeae1bae57e5fe0bf135116f4e4c11c6d1ba Mon Sep 17 00:00:00 2001 From: Amy Boyd Date: Thu, 22 Dec 2016 14:23:43 +0000 Subject: [PATCH] Document how to use in a Git pre-commit hook. --- README.md | 12 ++++++++++++ docs/to-do.md | 5 ----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5639cf5..f284946 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,18 @@ needed! * It's super fast. The `check` command finishes small codebases in well under 1 second, and a 250k line codebase is checked in under 3 seconds. +Use in a Git pre-commit hook +---------------------------- + +``` +editorconfig-cli check src/ tests/ +if [[ $? != '0' ]]; then + echo 'Code is not aligned with .editorconfig' + echo 'Review the output and commit your fixes' + exit 1 +fi +``` + How to contribute ----------------- diff --git a/docs/to-do.md b/docs/to-do.md index a2fe200..7ecb41a 100644 --- a/docs/to-do.md +++ b/docs/to-do.md @@ -8,8 +8,3 @@ * The file pattern `{num1..num2}` is not fully implemented yet. See `ConvertWildcardPatternToGoRegexp` in `path_matcher.go` - -* Add an example of how to use the `check` command in a continuous integration build or in a Git -pre-commit hook. - -