feat: ignore unknown args

Do not throw when parsing unknown args, instead parse only known args print the unknown ones (supersedes #4216)
This commit is contained in:
psychedelicious 2023-09-08 10:40:48 +10:00 committed by Kent Keirsey
parent 24d9357fdc
commit 1d2636aa90

View File

@ -42,7 +42,9 @@ class InvokeAISettings(BaseSettings):
def parse_args(self, argv: list = sys.argv[1:]):
parser = self.get_parser()
opt = parser.parse_args(argv)
opt, unknown_opts = parser.parse_known_args(argv)
if len(unknown_opts) > 0:
print("Unknown args:", unknown_opts)
for name in self.__fields__:
if name not in self._excluded():
value = getattr(opt, name)