aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-04-22 17:13:24 +0200
committerWojtek Kosior <koszko@koszko.org>2022-04-25 13:19:07 +0200
commitff0f2d207c47b9e473c356227b32c19e4510b4be (patch)
tree84b3064f031727f3d9e61ed56d71269ab5f620c8 /src
parent4d8810538798aa815a459f298349a03fc6b3ea3f (diff)
downloadhaketilo-hydrilla-ff0f2d207c47b9e473c356227b32c19e4510b4be.tar.gz
haketilo-hydrilla-ff0f2d207c47b9e473c356227b32c19e4510b4be.zip
support --help and --version options when running the sample wsgi script from command line
Diffstat (limited to 'src')
-rw-r--r--src/hydrilla/server/__init__.py2
-rw-r--r--src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po14
-rw-r--r--src/hydrilla/server/serve.py13
3 files changed, 25 insertions, 4 deletions
diff --git a/src/hydrilla/server/__init__.py b/src/hydrilla/server/__init__.py
index baa78cc..7bd71ea 100644
--- a/src/hydrilla/server/__init__.py
+++ b/src/hydrilla/server/__init__.py
@@ -5,4 +5,4 @@
# Available under the terms of Creative Commons Zero v1.0 Universal.
from . import config
-from .serve import HydrillaApp
+from .serve import start, start_wsgi
diff --git a/src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po b/src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po
index a532a37..7ea930a 100644
--- a/src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po
+++ b/src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: hydrilla.builder 0.1\n"
"Report-Msgid-Bugs-To: koszko@koszko.org\n"
-"POT-Creation-Date: 2022-04-19 14:22+0200\n"
+"POT-Creation-Date: 2022-04-22 17:09+0200\n"
"PO-Revision-Date: 2022-02-12 00:00+0000\n"
"Last-Translator: Wojtek Kosior <koszko@koszko.org>\n"
"Language: en_US\n"
@@ -67,6 +67,7 @@ msgstr ""
"'{pattern}')."
#: src/hydrilla/server/serve.py:566 src/hydrilla/server/serve.py:588
+#: src/hydrilla/server/serve.py:626
#, python-format
msgid "%(prog)s_%(version)s_license"
msgstr ""
@@ -108,7 +109,7 @@ msgstr ""
"Language to use (also affects served HTML files). Overrides value from "
"the config file (if any)."
-#: src/hydrilla/server/serve.py:589
+#: src/hydrilla/server/serve.py:589 src/hydrilla/server/serve.py:627
msgid "version_printing"
msgstr "Print version information and exit."
@@ -125,6 +126,15 @@ msgstr ""
"Hydrilla instance. For better performance, consider deployment using "
"WSGI."
+#: src/hydrilla/server/serve.py:632
+msgid "serve_hydrilla_packages_wsgi_help"
+msgstr ""
+"Serve Hydrilla packages.\n"
+"\n"
+"This program is a WSGI script that runs Hydrilla repository behind an "
+"HTTP server like Apache2 or Nginx. You can configure Hydrilla through the"
+" /etc/hydrilla/config.json file."
+
#. 'hydrilla' as a title
#: src/hydrilla/server/templates/base.html:99
#: src/hydrilla/server/templates/base.html:105
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index 9e51324..d2835f6 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -558,7 +558,7 @@ def query():
@bp.route('/--help')
def mm_help():
- return start.get_help(click.Context(start)) + '\n'
+ return start.get_help(click.Context(start_wsgi)) + '\n'
@bp.route('/--version')
def mm_version():
@@ -621,3 +621,14 @@ def start(malcontent_dir: Optional[str], hydrilla_project_url: Optional[str],
start.__doc__ = _('serve_hydrilla_packages_explain_wsgi_considerations')
start = click.command()(start)
+
+@click.version_option(version=_version.version, prog_name='Hydrilla',
+ message=_('%(prog)s_%(version)s_license'),
+ help=_('version_printing'))
+def start_wsgi(_config=None) -> None:
+ """<this will be replaced by a localized docstring for Click to pick up>"""
+ return HydrillaApp(_config or config.load())
+
+start_wsgi.__doc__ = _('serve_hydrilla_packages_wsgi_help')
+
+start_wsgi = click.command()(start_wsgi)