Skip to content
Myr

Merge pull request #1918 from pallets/disable-windows-expansion

Before adoption: this commit came in with the history the project adopted, so no landing records it.

flag to control Windows pattern expansion

authored by David Lord · committed by GitHub · parents fcf8205, 6439aae · Browse files · 2 files+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−1 removed

  • other:+12 added−1 removed

2 files+12 added−1 removed

modified:src/click/core.py+8 added-1 removed
991 unmodified lines
992 args: t.Optional[t.Sequence[str]] = None,993 prog_name: t.Optional[str] = None,994 complete_var: t.Optional[str] = None,995 standalone_mode: bool = True,996 windows_expand_args: bool = True,997 **extra: t.Any,998 ) -> t.Any:999 """This is the way to invoke a script with all the bells and1000 whistles as a command line application. This will always terminate
20 unmodified lines
1021 this is set to `False` they will be1022 propagated to the caller and the return1023 value of this function is the return value1024 of :meth:`invoke`.1025 :param windows_expand_args: Expand glob patterns, user dir, and1026 env vars in command line args on Windows.1027 :param extra: extra keyword arguments are forwarded to the context1028 constructor. See :class:`Context` for more information.10291030 .. versionchanged:: 8.0.11031 Added the ``windows_expand_args`` parameter to allow1032 disabling command line arg expansion on Windows.10331034 .. versionchanged:: 8.01035 When taking arguments from ``sys.argv`` on Windows, glob1036 patterns, user dir, and env vars are expanded.1037
6 unmodified lines
10441045 if args is None:1046 args = sys.argv[1:]10471041 if os.name == "nt":1048 if os.name == "nt" and windows_expand_args:1049 args = _expand_args(args)1050 else:1051 args = list(args)1052
1905 unmodified lines
modified:CHANGES.rst+4 added
25 unmodified lines
26 override ``resolve_command`` to change the name that is returned if27 needed. :issue:`1895`28- If a default value is invalid, it does not prevent showing help29 text. :issue:`1889`30- Pass ``windows_expand_args=False`` when calling the main command to31 disable pattern expansion on Windows. There is no way to escape32 patterns in CMD, so if the program needs to pass them on as-is then33 expansion must be disabled. :issue:`1901`343536Version 8.0.037-------------
856 unmodified lines