POC for --dry-run param in run command

This commit is contained in:
Emmanuel Leblond 2023-11-18 13:44:30 +01:00
parent 2280645d0e
commit 455fc07ad9
No known key found for this signature in database
GPG key ID: C360860E645EFFC0
10 changed files with 40 additions and 10 deletions

View file

@ -55,6 +55,7 @@ class Language(Protocol):
is_local: bool,
require_serial: bool,
color: bool,
dry_run: bool,
) -> tuple[int, bytes]:
...
@ -158,6 +159,7 @@ def run_xargs(
*,
require_serial: bool,
color: bool,
dry_run: bool,
) -> tuple[int, bytes]:
if require_serial:
jobs = 1
@ -167,7 +169,7 @@ def run_xargs(
# ordering.
file_args = _shuffled(file_args)
jobs = target_concurrency()
return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color)
return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color, dry_run=dry_run)
def hook_cmd(entry: str, args: Sequence[str]) -> tuple[str, ...]:
@ -183,10 +185,12 @@ def basic_run_hook(
is_local: bool,
require_serial: bool,
color: bool,
dry_run: bool,
) -> tuple[int, bytes]:
return run_xargs(
hook_cmd(entry, args),
file_args,
require_serial=require_serial,
color=color,
dry_run=dry_run,
)