feat(config): add flag to indicate if args were parsed

This flag acts as a proxy for the `get_config()` function to determine if the full application is running.

If it was, the config will set the root, do HF login, etc.

If not (e.g. it's called by an external script), all that stuff will be skipped.
This commit is contained in:
psychedelicious
2024-03-19 15:53:04 +11:00
parent 6af6673a4f
commit ee3096f616
2 changed files with 7 additions and 0 deletions

View File

@ -34,9 +34,11 @@ class InvokeAIArgs:
"""
args: Optional[Namespace] = None
did_parse: bool = False
@staticmethod
def parse_args() -> Optional[Namespace]:
"""Parse CLI args and store the result."""
InvokeAIArgs.args = _parser.parse_args()
InvokeAIArgs.did_parse = True
return InvokeAIArgs.args