mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 00:24:47 +04:00
POC for --dry-run param in run command
This commit is contained in:
parent
2280645d0e
commit
455fc07ad9
10 changed files with 40 additions and 10 deletions
|
|
@ -130,6 +130,7 @@ def run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]: # pragma: win32 no cover
|
||||
# Rebuild the docker image in case it has gone missing, as many people do
|
||||
# automated cleanup of docker images.
|
||||
|
|
@ -143,4 +144,5 @@ def run_hook(
|
|||
file_args,
|
||||
require_serial=require_serial,
|
||||
color=color,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ def run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]: # pragma: win32 no cover
|
||||
cmd = docker_cmd() + lang_base.hook_cmd(entry, args)
|
||||
return lang_base.run_xargs(
|
||||
|
|
@ -29,4 +30,5 @@ def run_hook(
|
|||
file_args,
|
||||
require_serial=require_serial,
|
||||
color=color,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -96,9 +96,10 @@ def run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
cmd = (sys.executable, '-m', __name__, *args, entry)
|
||||
return xargs(cmd, file_args, color=color)
|
||||
return xargs(cmd, file_args, color=color, dry_run=dry_run)
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ def run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
cmd = _cmd_from_hook(prefix, entry, args, is_local=is_local)
|
||||
return lang_base.run_xargs(
|
||||
|
|
@ -192,4 +193,5 @@ def run_hook(
|
|||
file_args,
|
||||
require_serial=require_serial,
|
||||
color=color,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ def run_hook(
|
|||
is_local: bool,
|
||||
require_serial: bool,
|
||||
color: bool,
|
||||
dry_run: bool,
|
||||
) -> tuple[int, bytes]:
|
||||
cmd = lang_base.hook_cmd(entry, args)
|
||||
cmd = (prefix.path(cmd[0]), *cmd[1:])
|
||||
|
|
@ -29,4 +30,5 @@ def run_hook(
|
|||
file_args,
|
||||
require_serial=require_serial,
|
||||
color=color,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue