lib.App: Stay functional without autocomplete

If Python's autocomplete is not installed, jw-pkg.py fails to run
commands. Fix that in order stay compatible with minimal excecution
environments.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-02 12:15:38 +01:00
commit 53ba9e6fbe

View file

@ -2,7 +2,7 @@
from typing import Any from typing import Any
import os, sys, argcomplete, argparse, re, asyncio, cProfile import os, sys, argparse, re, asyncio, cProfile
from .log import * from .log import *
from .Types import LoadTypes from .Types import LoadTypes
@ -91,7 +91,11 @@ class App: # export
async def __run(self, argv=None) -> None: async def __run(self, argv=None) -> None:
try:
import argcomplete # Don't require it to be compatible with minimal environments
argcomplete.autocomplete(self.__parser) argcomplete.autocomplete(self.__parser)
except:
pass
self.__args = self.__parser.parse_args(args=argv) self.__args = self.__parser.parse_args(args=argv)