question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for "xargs -n1" hooks?

See original GitHub issue

Some 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Feb 20, 2020

slight adjustment, to properly handle spaces you need:

    entry: bash -c 'for x in "$@"; do ... "$x"; done' --
0reactions
asottilecommented, Jan 25, 2022

please stop grave digging old issues to “rally the troops” – this is not going to be implemented

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found