From 6be576aa634b9307ef2710d7d9ac71e8c5ec9df3 Mon Sep 17 00:00:00 2001 From: Von Random Date: Tue, 18 Oct 2016 20:00:43 +0300 Subject: [PATCH] initial commit --- .gitignore | 3 +++ conf.ini | 5 +++++ plugins/date.py | 6 ++++++ vdstatus.py | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 .gitignore create mode 100644 conf.ini create mode 100644 plugins/date.py create mode 100644 vdstatus.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..35ba9cd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.iml +.idea diff --git a/conf.ini b/conf.ini new file mode 100644 index 0000000..452e091 --- /dev/null +++ b/conf.ini @@ -0,0 +1,5 @@ +[main] +some_option = some value + +[date] +format = %%A %%d %%H:%%M \ No newline at end of file diff --git a/plugins/date.py b/plugins/date.py new file mode 100644 index 0000000..18a38ce --- /dev/null +++ b/plugins/date.py @@ -0,0 +1,6 @@ +import time + + +def run(conf): + fmt = conf['date']['format'] + return time.strftime(fmt) diff --git a/vdstatus.py b/vdstatus.py new file mode 100644 index 0000000..495d11c --- /dev/null +++ b/vdstatus.py @@ -0,0 +1,14 @@ +import sys +import os +import configparser +import importlib +import plugins + + +DEFAULT_CONFIG = os.path.join(os.environ['HOME'], 'IdeaProjects/vdstatus/conf.ini') + +configuration = configparser.ConfigParser() +configuration.read(DEFAULT_CONFIG) + +importlib.import_module('.date', 'plugins') +print(plugins.date.run(configuration))