refactoring to use ApplicationContext

This commit is contained in:
Vinicius Moreira
2019-08-30 13:06:24 -03:00
parent 60fc6d8872
commit 71959e8e04
4 changed files with 25 additions and 36 deletions

View File

@@ -16,7 +16,7 @@ def log_msg(msg: str, color: int = None):
def read() -> Namespace:
parser = argparse.ArgumentParser(prog=__app_name__, description="GUI for Flatpak applications management")
parser = argparse.ArgumentParser(prog=__app_name__, description="GUI for Linux packages management")
parser.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(__version__))
parser.add_argument('-e', '--cache-exp', action="store",
default=int(os.getenv('BAUH_CACHE_EXPIRATION', 60 * 60)), type=int,
@@ -35,13 +35,13 @@ def read() -> Namespace:
help='Enables / disables disk cache. When disk cache is enabled, the installed applications data are loaded faster. Default: %(default)s')
parser.add_argument('-di', '--download-icons', action="store", choices=[0, 1],
default=os.getenv('BAUH_DOWNLOAD_ICONS', 1), type=int,
help='Enables / disables app icons download. It may improve the application speed, depending of how applications data are retrieved by their extensions.')
help='Enables / disables package icons download. It may improve the application speed, depending of how applications data are retrieved by their extensions.')
parser.add_argument('-co', '--check-packaging-once', action="store",
default=os.getenv('BAUH_CHECK_PACKAGING_ONCE', 0), choices=[0, 1], type=int,
help='If the available supported packaging types should be checked ONLY once. It improves the application speed if enabled, but can generate errors if you uninstall any packaging technology while using it, and every time a supported packaging type is installed it will only be available after a restart. Default: %(default)s')
parser.add_argument('--tray', action="store", default=os.getenv('BAUH_TRAY', 0), choices=[0, 1], type=int,
help='If the tray icon and update-check daemon should be created. Default: %(default)s')
parser.add_argument('--sugs', action="store", default=os.getenv('BAUH_SUGGESTIONS', 1), choices=[0, 1], type=int, help='If app suggestions should be displayed if no app is installed (runtimes do not count as apps). Default: %(default)s')
parser.add_argument('--sugs', action="store", default=os.getenv('BAUH_SUGGESTIONS', 1), choices=[0, 1], type=int, help='If app suggestions should be displayed if no application package is installed (runtimes / libraries do not count as apps). Default: %(default)s')
args = parser.parse_args()
if args.cache_exp < 0: