From 917a7155f436af708443d99590b858fa0794461d Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Thu, 24 Feb 2022 12:51:06 +0200 Subject: [PATCH] Add `--stdin-filepath` command line argument --- src/darker/command_line.py | 1 + src/darker/help.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/darker/command_line.py b/src/darker/command_line.py index bffb3f78f..4b25f2789 100644 --- a/src/darker/command_line.py +++ b/src/darker/command_line.py @@ -39,6 +39,7 @@ def add_arg(help_text: Optional[str], *name_or_flags: str, **kwargs: Any) -> Non add_arg(hlp.REVISION, "-r", "--revision", default="HEAD", metavar="REV") add_arg(hlp.DIFF, "--diff", action="store_true") add_arg(hlp.STDOUT, "-d", "--stdout", action="store_true") + add_arg(hlp.STDIN_FILEPATH, "--stdin-filepath", metavar="PATH") add_arg(hlp.CHECK, "--check", action="store_true") add_arg(hlp.ISORT, "-i", "--isort", action="store_true") add_arg(hlp.LINT, "-L", "--lint", action="append", metavar="CMD", default=[]) diff --git a/src/darker/help.py b/src/darker/help.py index ee36291d8..24e782597 100644 --- a/src/darker/help.py +++ b/src/darker/help.py @@ -46,6 +46,11 @@ " there's just one file to reformat." ) +STDIN_FILEPATH = ( + "Path to the file in the Git repository that Darker will treat stdin as. Only valid" + " with `--revision=..:WORKTREE:` (`:WORKTREE:` being the default for `rev2`)" +) + ISORT_PARTS = ["Also sort imports using the `isort` package"] if not isort: ISORT_PARTS.append(f". {ISORT_INSTRUCTION} to enable usage of this option.")