fix crash when --prompt="prompt" is used in CLI

- The following were supposed to be equivalent, but the latter crashes:
```
invoke> banana sushi
invoke> --prompt="banana sushi"
```
This PR fixes the problem.

- Fixes #2548
This commit is contained in:
Lincoln Stein 2023-02-07 22:09:34 -05:00
parent 9c2b9af3a8
commit 67f892455f

View File

@ -230,7 +230,8 @@ class Args(object):
switches = ''
try:
self._cmd_switches = self._cmd_parser.parse_args(shlex.split(switches,comments=True))
setattr(self._cmd_switches,'prompt',prompt)
if not getattr(self._cmd_switches,'prompt'):
setattr(self._cmd_switches,'prompt',prompt)
return self._cmd_switches
except:
return None