From 71539b7eb63beac09ad64f8e866536fc0ffb6083 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 7 Sep 2022 03:30:25 -0400 Subject: add more arguments --- src/hiccup/helpers.py | 12 ++++++------ src/hiccup/hiccup.py | 21 +++++++++++++++++++-- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/hiccup/helpers.py b/src/hiccup/helpers.py index 2627e9d..af27684 100644 --- a/src/hiccup/helpers.py +++ b/src/hiccup/helpers.py @@ -54,14 +54,14 @@ class DistroHelper: # iterate through dict of commands, optionally allow for keys to # determine the shell the command is run though - def __run_items(self, msg: str, dct: dict, name_as_shell=False): + def __run_items(self, msg: str, dct: dict, name_as_shell=False, output=False): shell = "bash" for name, cmd in dct.items(): print(msg.format(name)) if name_as_shell: shell = name - self.__sys_cmd(cmd, shell=shell, silent=True) # nosec:B604 + self.__sys_cmd(cmd, shell=shell, silent=output) # nosec:B604 def is_supported(self): return self.id in self.__system_update_cmds @@ -96,14 +96,14 @@ class DistroHelper: msg = "updating {} plugins..." return self.__run_items(msg, self.__shell_plugin_cmds, name_as_shell=True) - def update_other(self): + def update_other(self, output): msg = "updating {}..." - return self.__run_items(msg, self.__other_cmds) + return self.__run_items(msg, self.__other_cmds, output) - def update_all(self): + def update_all(self, output): self.update_system() self.update_shell_plugins() - self.update_other() + self.update_other(output) self.cleanup_system() diff --git a/src/hiccup/hiccup.py b/src/hiccup/hiccup.py index 3ba89cd..673e697 100644 --- a/src/hiccup/hiccup.py +++ b/src/hiccup/hiccup.py @@ -34,11 +34,28 @@ def run(): dest="system_only", help="only update through the system's package manager", ) + parser.add_argument( + "--otheronly", + "-o", + action="store_true", + default=False, + dest="other_only", + help="only update misc package managers", + ) + parser.add_argument( + "--no-output" "-n", + action="store_true", + default=False, + dest="output", + help="silence output of misc package managers", + ) args = parser.parse_args() if args.clean_only: return distro.cleanup_system() - if args.system_only: + elif args.system_only: return distro.update_system() + elif args.other_only: + return distro.update_other(args.output) - return distro.update_all() + return distro.update_all(args.output) -- cgit v1.2.3