Compare commits
No commits in common. "528115691a7c034a95f8a56bfb14dae90a1606a9" and "a9fa15d643069c36909a2403c643d88f86e8c7ab" have entirely different histories.
528115691a
...
a9fa15d643
3 changed files with 11 additions and 11 deletions
|
@ -17,25 +17,25 @@ from sshare.plugin import Plugin
|
||||||
class Logger:
|
class Logger:
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if kwargs.get("preload_command_line") == True:
|
if kwargs.get("preload_command_line") == True:
|
||||||
self._loggers = [ Plugin.internal("command_line") ]
|
self.loggers = [ Plugin.internal("command_line") ]
|
||||||
else:
|
else:
|
||||||
self._loggers = []
|
self.loggers = []
|
||||||
self.add(*args)
|
self.add(*args)
|
||||||
|
|
||||||
def add(self, *args, **kwargs):
|
def add(self, *args, **kwargs):
|
||||||
for logger in args:
|
for logger in args:
|
||||||
self._loggers.append()
|
self.loggers.append()
|
||||||
|
|
||||||
def info(self, message):
|
def info(self, message):
|
||||||
for logger in self._loggers:
|
for logger in self.loggers:
|
||||||
logger.info(message)
|
logger.info(message)
|
||||||
|
|
||||||
def warn(self, message):
|
def warn(self, message):
|
||||||
for logger in self._loggers:
|
for logger in self.loggers:
|
||||||
logger.warn(message)
|
logger.warn(message)
|
||||||
|
|
||||||
def error(self, message):
|
def error(self, message):
|
||||||
for logger in self._loggers:
|
for logger in self.loggers:
|
||||||
logger.error(message)
|
logger.error(message)
|
||||||
|
|
||||||
def fatal(self, message, error_code=1):
|
def fatal(self, message, error_code=1):
|
||||||
|
|
|
@ -150,7 +150,7 @@ def main():
|
||||||
if isinstance(plugin.activate, dict):
|
if isinstance(plugin.activate, dict):
|
||||||
criteria = plugin.activate[plugin_type]
|
criteria = plugin.activate[plugin_type]
|
||||||
for criterion in criteria:
|
for criterion in criteria:
|
||||||
logger.error(f" {plugin.args[criterion]}")
|
logger.error(f" {plugin.args[criterion].pretty()}")
|
||||||
error = True
|
error = True
|
||||||
if error:
|
if error:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -39,7 +39,10 @@ class Argument:
|
||||||
self.choices = choices
|
self.choices = choices
|
||||||
self.help = help
|
self.help = help
|
||||||
|
|
||||||
def __str__(self):
|
def is_valid(self):
|
||||||
|
return (self.short != None and self.short != "") or (self.long != None and self.long != "")
|
||||||
|
|
||||||
|
def pretty(self):
|
||||||
if self.short and self.long:
|
if self.short and self.long:
|
||||||
pretty = f"-{self.short}, --{self.long}"
|
pretty = f"-{self.short}, --{self.long}"
|
||||||
elif self.long:
|
elif self.long:
|
||||||
|
@ -48,9 +51,6 @@ class Argument:
|
||||||
pretty = f"-{self.short}"
|
pretty = f"-{self.short}"
|
||||||
return pretty + f" {self.help}"
|
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):
|
def bind(self, plugin, argument):
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.metavar = argument
|
self.metavar = argument
|
||||||
|
|
Loading…
Reference in a new issue