summaryrefslogtreecommitdiff
path: root/src/hydrilla/server/serve.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-04-19 14:38:30 +0200
committerWojtek Kosior <koszko@koszko.org>2022-04-19 14:38:30 +0200
commit21ed4b30355f2e61495d5ba41516988a507ffa76 (patch)
tree72e62397776ef727cda7f04e8df8af5f7d583648 /src/hydrilla/server/serve.py
parentb2c167f1c7713785813ff4cd93aff3cd235f4ffe (diff)
downloadhaketilo-hydrilla-21ed4b30355f2e61495d5ba41516988a507ffa76.tar.gz
haketilo-hydrilla-21ed4b30355f2e61495d5ba41516988a507ffa76.zip
add support for --version option; expose --version and --help over HTTP
Diffstat (limited to 'src/hydrilla/server/serve.py')
-rw-r--r--src/hydrilla/server/serve.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index 6cb98c2..9e51324 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -556,6 +556,15 @@ def query():
return Response(json.dumps(result), mimetype='application/json')
+@bp.route('/--help')
+def mm_help():
+ return start.get_help(click.Context(start)) + '\n'
+
+@bp.route('/--version')
+def mm_version():
+ prog_info = {'prog': 'Hydrilla', 'version': _version.version}
+ return _('%(prog)s_%(version)s_license') % prog_info + '\n'
+
default_config_path = Path('/etc/hydrilla/config.json')
default_malcontent_dir = '/var/lib/hydrilla/malcontent'
default_project_url = 'https://hydrillabugs.koszko.org/projects/hydrilla/wiki'
@@ -575,6 +584,9 @@ _ = console_gettext
help=_('path_to_config_file_explain_default'))
@click.option('-l', '--language', type=click.STRING,
help=_('language_to_use_overrides_config'))
+@click.version_option(version=_version.version, prog_name='Hydrilla',
+ message=_('%(prog)s_%(version)s_license'),
+ help=_('version_printing'))
def start(malcontent_dir: Optional[str], hydrilla_project_url: Optional[str],
port: Optional[int], config_path: Optional[str],
language: Optional[str]) -> None: