fix crash when --prompt="prompt" is used in CLI (#2579)

- 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-08 11:36:20 -05:00 committed by GitHub
commit 350b5205a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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