From 528115691a7c034a95f8a56bfb14dae90a1606a9 Mon Sep 17 00:00:00 2001 From: Gnarwhal Date: Wed, 4 Sep 2024 17:53:01 +0000 Subject: [PATCH] Use __str__ to print plugin arguments --- src/sshare/main.py | 2 +- src/sshare/plugins/config.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sshare/main.py b/src/sshare/main.py index 445c046..18b0e5d 100644 --- a/src/sshare/main.py +++ b/src/sshare/main.py @@ -150,7 +150,7 @@ def main(): if isinstance(plugin.activate, dict): criteria = plugin.activate[plugin_type] for criterion in criteria: - logger.error(f" {plugin.args[criterion].pretty()}") + logger.error(f" {plugin.args[criterion]}") error = True if error: sys.exit(1) diff --git a/src/sshare/plugins/config.py b/src/sshare/plugins/config.py index 7fb7c2a..305a546 100644 --- a/src/sshare/plugins/config.py +++ b/src/sshare/plugins/config.py @@ -39,10 +39,7 @@ class Argument: self.choices = choices self.help = help - def is_valid(self): - return (self.short != None and self.short != "") or (self.long != None and self.long != "") - - def pretty(self): + def __str__(self): if self.short and self.long: pretty = f"-{self.short}, --{self.long}" elif self.long: @@ -51,6 +48,9 @@ class Argument: pretty = f"-{self.short}" return pretty + f" {self.help}" + def is_valid(self): + return (self.short != None and self.short != "") or (self.long != None and self.long != "") + def bind(self, plugin, argument): self.plugin = plugin self.metavar = argument