Open lig opened 3 years ago
Another option is to use python
hook type as a wrapper. From the pre-commit docs: Support: python hooks work without any system-level dependencies. It has been tested on linux, macOS, windows, and cygwin.
https://pre-commit.com/#python
A simple python script will work on any platform and it is easy enough to parse arguments and invoke the proper command from it.
Well, according to the docs the entire repo must be installable as a python package. This will require some additional files in the repo root. Seems a bit inconvenient.
See #63
At the moment, the pre-commit hook definition expects
dart
/flutter
executables to be accessible in the search path.However, it is a common practice to install several channels on the same machine and use different executable names for them. i.e.
flutter-stable
,dart-beta
, etc.It is possible to implement a hook that takes an executable name/path as an argument in the
args
parameter, see https://pre-commit.com/#passing-arguments-to-hooks. However, this requires transforming the definition in thescript
type and using an additional script that would construct the corresponding command to execute. The problem is we cannot just usebash
for this as Windows users won't be able to use it.