aboutsummaryrefslogtreecommitdiff
path: root/src/hydrilla
diff options
context:
space:
mode:
Diffstat (limited to 'src/hydrilla')
-rw-r--r--src/hydrilla/server/serve.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/hydrilla/server/serve.py b/src/hydrilla/server/serve.py
index d07d44f..a6a1204 100644
--- a/src/hydrilla/server/serve.py
+++ b/src/hydrilla/server/serve.py
@@ -572,6 +572,7 @@ default_project_url = 'https://hydrillabugs.koszko.org/projects/hydrilla/wiki'
console_gettext = util.translation(here / 'locales').gettext
_ = console_gettext
+@click.command(help=_('serve_hydrilla_packages_explain_wsgi_considerations'))
@click.option('-m', '--malcontent-dir',
type=click.Path(exists=True, file_okay=False),
help=_('directory_to_serve_from_overrides_config'))
@@ -590,7 +591,12 @@ _ = console_gettext
def start(malcontent_dir: Optional[str], hydrilla_project_url: Optional[str],
port: Optional[int], config_path: Optional[str],
language: Optional[str]) -> None:
- """<this will be replaced by a localized docstring for Click to pick up>"""
+ """
+ Run a development Hydrilla server.
+
+ This command is meant to be the entry point of hydrilla command exported by
+ this package.
+ """
config_load_opts = {} if config_path is None \
else {'config_path': [Path(config_path)]}
@@ -618,20 +624,19 @@ def start(malcontent_dir: Optional[str], hydrilla_project_url: Optional[str],
HydrillaApp(hydrilla_config).run()
-start.__doc__ = _('serve_hydrilla_packages_explain_wsgi_considerations')
-
-start = click.command()(start)
-
+@click.command(help=_('serve_hydrilla_packages_wsgi_help'),
+ context_settings={
+ 'ignore_unknown_options': True,
+ 'allow_extra_args': True
+ })
@click.version_option(version=_version.version, prog_name='Hydrilla',
message=_('%(prog)s_%(version)s_license'),
help=_('version_printing'))
def start_wsgi() -> None:
- """<this will be replaced by a localized docstring for Click to pick up>"""
- return HydrillaApp(click.get_current_context().obj or config.load())
-
-start_wsgi.__doc__ = _('serve_hydrilla_packages_wsgi_help')
+ """
+ Create application object for use in WSGI deployment.
-start_wsgi = click.command(context_settings={
- 'ignore_unknown_options': True,
- 'allow_extra_args': True
-})(start_wsgi)
+ This command Also handles --help and --version options in case it gets
+ called outside WSGI environment.
+ """
+ return HydrillaApp(click.get_current_context().obj or config.load())