From 9ca9d286337999569408255abeb72e6f00ef8647 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 21 Jun 2022 00:52:24 +0300 Subject: [PATCH] Update cli menu view --- ChangeLog.txt | 4 ++++ README.rst | 32 +++++++++++++++++--------------- slpkg/views/cli_menu.py | 36 ++++++++++++++++++++++-------------- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b0ceecf9..7fd27e2d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +4.1.1 - 21/06/2022 +Updated: +- Cli menu view with colors + 4.1.0 - 20/06/2022 Updated: - slpkg code re-written from the beginning and currently supports only the SBo repository diff --git a/README.rst b/README.rst index dbc8beb5..d3253036 100644 --- a/README.rst +++ b/README.rst @@ -41,25 +41,27 @@ Usage $ slpkg --help - Usage: slpkg [OPTIONS] + USAGE: slpkg [OPTIONS] - Packaging tool that interacts with the SBo repository. + Packaging tool that interacts with the SBo repository. - Options: - update Update the package lists. - build Build only the packages. - install Build and install the packages. - remove Remove installed packages. - search Search packages by name. - clean-logs Purge logs of dependencies. + OPTIONS: + update Update the package lists. + build Build only the packages. + install Build and install the packages. + remove Remove installed packages. + search Search packages by name. + clean-logs Purge logs of dependencies. - --yes Answer Yes to all questions. - --jobs Set it for multicore systems. - --resolve-off Turns off dependency resolving. - --reinstall Use this option if you want to upgrade. + --yes Answer Yes to all questions. + --jobs Set it for multicore systems. + --resolve-off Turns off dependency resolving. + --reinstall Use this option if you want to upgrade. - -h, --help Show this message and exit. - -v, --version Print version and exit. + -h, --help Show this message and exit. + -v, --version Print version and exit. + + If you need more information try to use slpkg manpage. Configuration files diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 083901f6..87daa478 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -6,21 +6,29 @@ from slpkg.configs import Configs def usage(status: int): - args = [f'Usage: {Configs.prog_name} [OPTIONS] [packages]\n', + colors = Configs.colour + color = colors() + + RED = color['RED'] + CYAN = color['CYAN'] + YELLOW = color['YELLOW'] + ENDC = color['ENDC'] + + args = [f'USAGE: {Configs.prog_name} [{CYAN}OPTIONS{ENDC}] \n', ' Packaging tool that interacts with the SBo repository.\n', - 'Options:', - ' update Update the package lists.', - ' build Build only the packages.', - ' install Build and install the packages.', - ' remove Remove installed packages.', - ' search Search packages by name.', - ' clean-logs Purge logs of dependencies.\n', - ' --yes Answer Yes to all questions.', - ' --jobs Set it for multicore systems.', - ' --resolve-off Turns off dependency resolving.', - ' --reinstall Use this option if you want to upgrade.\n', - ' -h, --help Show this message and exit.', - ' -v, --version Print version and exit.\n', + 'OPTIONS:', + f' {RED}update{ENDC} Update the package lists.', + f' {CYAN}build{ENDC} Build only the packages.', + f' {CYAN}install{ENDC} Build and install the packages.', + f' {CYAN}remove{ENDC} Remove installed packages.', + f' {CYAN}search{ENDC} Search packages by name.', + f' {CYAN}clean-logs{ENDC} Purge logs of dependencies.\n', + f' {YELLOW}--yes{ENDC} Answer Yes to all questions.', + f' {YELLOW}--jobs{ENDC} Set it for multicore systems.', + f' {YELLOW}--resolve-off{ENDC} Turns off dependency resolving.', + f' {YELLOW}--reinstall{ENDC} Use this option if you want to upgrade.\n', + ' -h, --help Show this message and exit.', + ' -v, --version Print version and exit.\n', 'If you need more information try to use slpkg manpage.'] for opt in args: