From 67f892455f6cc0bf798a57ee82b9f0072c6cac17 Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Tue, 7 Feb 2023 22:09:34 -0500 Subject: [PATCH] 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 --- ldm/invoke/args.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ldm/invoke/args.py b/ldm/invoke/args.py index c9c7ffe3b0..ace0786154 100644 --- a/ldm/invoke/args.py +++ b/ldm/invoke/args.py @@ -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