Add support for "xargs -n1" hooks?
See original GitHub issueSome hooks are only written to run against a single file at a time. An example is stylefmt
.
You can hack around it with a wrapper script, but it’s nice to avoid those when possible. The pre-commit xargs implementation already would make it easy to partition into groups of one file.
How do you feel instead about adding a hook parameter like max_files_per_exec
(questionable name)? Zero or default could keep the current behavior, and you could set to 1
to get the behavior we want here.
cc @SBoudrias
P.S. here’s a crazy hack just for kicks:
- repo: local
hooks:
- id: test
name: test
language: system
files: .*
entry: /bin/bash
args: ['-c', 'echo $@ | xargs -n1 stylefmt', 'garbage']
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:12 (8 by maintainers)
Top Results From Across the Web
How to use -I{} with xargs' with an -n greater than 1?
Yes, -I only works with for one argument at a time. With -I , the input is also parsed into arguments in a...
Read more >xargs - man pages section 1: User Commands
xargs - build and execute command lines from standard input.
Read more >An Opinionated Guide to Xargs - Hacker News
Takeaways: (1) There is no consistency in flag names, even --long ones (2) impressively many tools do support it! Note that some affect...
Read more >How do I pipe commands together in a debian preseed file?
I would like to know if it is possible to pipe commands together in a preseed file. Something Like: d-i preseed/late_command string yes...
Read more >xargs and git issues in windows powershell - Super User
Powershell is hosted on GitHub. There are modules you can download and install for use with git/Github. Find-Module -Name ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
slight adjustment, to properly handle spaces you need:
please stop grave digging old issues to “rally the troops” – this is not going to be implemented