some more sensible defaults, get rid of todo
This commit is contained in:
parent
46f3d778af
commit
c70a4549cb
2 changed files with 8 additions and 11 deletions
|
@ -4,7 +4,7 @@ import psutil
|
||||||
|
|
||||||
class PluginThread(plugins.PluginThreadCommon):
|
class PluginThread(plugins.PluginThreadCommon):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
defaults = {'partition': '/', 'problem': 80}
|
defaults = {'partition': '/', 'problem': 80, 'freq': 15}
|
||||||
super(PluginThread, self).__init__(config, defaults)
|
super(PluginThread, self).__init__(config, defaults)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
|
|
17
vdstatus
17
vdstatus
|
@ -1,8 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# pylint: disable=C0111
|
# pylint: disable=C0111
|
||||||
# TODO: consider per plugin hide_ok overriding global, not the other way around
|
|
||||||
# TODO: add documentation / comments
|
|
||||||
# TODO: interactivity support
|
|
||||||
import argparse
|
import argparse
|
||||||
import importlib
|
import importlib
|
||||||
import json
|
import json
|
||||||
|
@ -14,6 +11,12 @@ import plugins
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIG = os.path.join(os.environ['HOME'], '.config/vdstatus/conf.yaml')
|
DEFAULT_CONFIG = os.path.join(os.environ['HOME'], '.config/vdstatus/conf.yaml')
|
||||||
|
DEFAULTS = {
|
||||||
|
'output_format': 'term',
|
||||||
|
'output_freq': 1,
|
||||||
|
'hide_ok': False,
|
||||||
|
'plugins': [{'name': 'date'}]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
|
@ -27,16 +30,10 @@ def parse_arguments():
|
||||||
|
|
||||||
class PluginRunner:
|
class PluginRunner:
|
||||||
def __init__(self, config_file=DEFAULT_CONFIG):
|
def __init__(self, config_file=DEFAULT_CONFIG):
|
||||||
defaults = {
|
|
||||||
'output_format': 'term',
|
|
||||||
'output_freq': 1,
|
|
||||||
'hide_ok': True,
|
|
||||||
'plugins': [{'name': 'date'}]
|
|
||||||
}
|
|
||||||
config = dict()
|
config = dict()
|
||||||
with open(config_file) as config_data:
|
with open(config_file) as config_data:
|
||||||
config = yaml.load(config_data)
|
config = yaml.load(config_data)
|
||||||
self.conf = plugins.parse_config(config, defaults)
|
self.conf = plugins.parse_config(config, DEFAULTS)
|
||||||
self.plugins_loaded = list()
|
self.plugins_loaded = list()
|
||||||
self.format_output = self.format_term
|
self.format_output = self.format_term
|
||||||
for plugin in self.conf['plugins']:
|
for plugin in self.conf['plugins']:
|
||||||
|
|
Loading…
Reference in a new issue