summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2022-08-05 22:56:08 -0400
committerseth <[email protected]>2022-08-05 22:56:08 -0400
commit2d53cc8a2ba81ca74ec8e2cb587bee5bd5f43e63 (patch)
treee4384ba5984bc02d54f658ca535a90c215936518
parent9afc51aec7203d356c8104fe3448c624ae16f372 (diff)
make clean commands optional
-rwxr-xr-xbin/hiccup15
1 files changed, 11 insertions, 4 deletions
diff --git a/bin/hiccup b/bin/hiccup
index e1613cc..ed64349 100755
--- a/bin/hiccup
+++ b/bin/hiccup
@@ -39,7 +39,8 @@ class CurrentDistro:
if self.is_supported():
self.update_cmd = self.get_update_cmd()
- self.clean_cmd = self.get_clean_cmd()
+ if self.has_clean_cmd():
+ self.clean_cmd = self.get_clean_cmd()
if self.has_extra_cmd():
self.extra_cmd = self.get_extra_cmd()
else:
@@ -64,6 +65,9 @@ class CurrentDistro:
def is_supported(self):
return self.id in self.__system_update_cmds
+ def has_clean_cmd(self):
+ return self.id in self.__clean_cmds
+
def has_extra_cmd(self):
return self.id in self.__extra_cmds
@@ -82,8 +86,10 @@ class CurrentDistro:
self.__sys_cmd(self.id, self.extra_cmd)
def clean_system(self):
- print('cleaning up system...')
- self.__sys_cmd(self.id, self.clean_cmd, prepend=self.__sudo)
+ if self.has_clean_cmd():
+ print('cleaning up system...')
+ return self.__sys_cmd(self.id, self.clean_cmd, prepend=self.__sudo)
+ raise DistroNotSupportedError(self.id)
def update_shell_plugins(self):
msg = 'updating {} plugins...'
@@ -97,7 +103,8 @@ class CurrentDistro:
self.update_system()
self.update_shell_plugins()
self.update_other()
- self.clean_system()
+ if self.has_clean_cmd():
+ self.clean_system()
def run():