Skip to content

Commit f0ecbcd

Browse files
authored
Add handling where argument is split at colon instead of equals. (#163)
Fixes #161
1 parent d26b802 commit f0ecbcd

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/manage/commands.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,11 @@ def __init__(self, args, root=None):
373373
seen_cmd = True
374374
elif a.startswith(("-", "/")):
375375
a, sep, v = a.partition(":")
376-
if not sep:
376+
if sep:
377+
if "=" in a:
378+
a, sep, v_pre = a.partition("=")
379+
v = f"{v_pre}:{v}"
380+
else:
377381
a, sep, v = a.partition("=")
378382
set_next = a.lstrip("-/").lower()
379383
try:

tests/test_commands.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,25 @@ def test_legacy_listpaths_command_help(assert_log, patched_installs):
8181
assert_log(
8282
assert_log.skip_until(r".*List command.+py list.+"),
8383
)
84+
85+
86+
def test_install_command_args():
87+
# This is not meant to be exhaustive test of every possible option, but
88+
# should cover all of the code paths in BaseCommand.__init__.
89+
for args in [
90+
["-v", "-y"],
91+
["--v", "--y"],
92+
["/v", "/y"],
93+
]:
94+
cmd = commands.InstallCommand(args)
95+
assert cmd.log_level == logging.VERBOSE
96+
assert not cmd.confirm
97+
98+
for args in [
99+
["--log", "C:\\LOG.txt"],
100+
["/log", "C:\\LOG.txt"],
101+
["--log:C:\\LOG.txt"],
102+
["--log=C:\\LOG.txt"],
103+
]:
104+
cmd = commands.InstallCommand(args)
105+
assert cmd.log_file == "C:\\LOG.txt"

0 commit comments

Comments
 (0)