Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 2, 2024
1 parent 8ed71f7 commit fa812e3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/click/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
from .types import File as File
from .types import FLOAT as FLOAT
from .types import FloatRange as FloatRange
from .types import FORWARD as FORWARD
from .types import INT as INT
from .types import IntRange as IntRange
from .types import ParamType as ParamType
from .types import Path as Path
from .types import STRING as STRING
from .types import Tuple as Tuple
from .types import UNPROCESSED as UNPROCESSED
from .types import FORWARD as FORWARD
from .types import UUID as UUID
from .utils import echo as echo
from .utils import format_filename as format_filename
Expand Down
2 changes: 1 addition & 1 deletion src/click/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def _stop_process_args_for_options(self, state: _ParsingState) -> bool:
return True
if not largs:
break
largs = largs[args.nargs:]
largs = largs[args.nargs :]
return False

def _process_args_for_options(self, state: _ParsingState) -> None:
Expand Down
23 changes: 16 additions & 7 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def cmd(f, files):

args = ["echo", "-foo", "bar", "-f", "-h", "--help"]
result = runner.invoke(cmd, args)
assert result.output.splitlines() == [''] + args
assert result.output.splitlines() == [""] + args


def test_forward_options_group(runner):
Expand All @@ -351,12 +351,21 @@ def cp(a, src, dsts):
for dst in dsts:
click.echo(dst)


result = runner.invoke(cmd, ["-f", "f", "cp", "-a", "a", "src", "dst1",
"-a", "dst2", "-h", "--help", "-f"])
assert result.output.splitlines() == ["f", "a", "src", "dst1", "-a", "dst2",
"-h", "--help", "-f"]

result = runner.invoke(
cmd,
["-f", "f", "cp", "-a", "a", "src", "dst1", "-a", "dst2", "-h", "--help", "-f"],
)
assert result.output.splitlines() == [
"f",
"a",
"src",
"dst1",
"-a",
"dst2",
"-h",
"--help",
"-f",
]


@pytest.mark.parametrize("doc", ["CLI HELP", None])
Expand Down

0 comments on commit fa812e3

Please sign in to comment.