diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-04-19 14:38:30 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-04-19 14:38:30 +0200 |
commit | 21ed4b30355f2e61495d5ba41516988a507ffa76 (patch) | |
tree | 72e62397776ef727cda7f04e8df8af5f7d583648 /src/hydrilla/server | |
parent | b2c167f1c7713785813ff4cd93aff3cd235f4ffe (diff) | |
download | haketilo-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')
-rw-r--r-- | src/hydrilla/server/locales/en_US/LC_MESSAGES/hydrilla-messages.po | 53 | ||||
-rw-r--r-- | src/hydrilla/server/serve.py | 12 |
2 files changed, 46 insertions, 19 deletions
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 6b5b25a..a532a37 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-02-12 16:10+0100\n" +"POT-Creation-Date: 2022-04-19 14:22+0200\n" "PO-Revision-Date: 2022-02-12 00:00+0000\n" "Last-Translator: Wojtek Kosior <koszko@koszko.org>\n" "Language: en_US\n" @@ -18,90 +18,105 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.8.0\n" -#: src/hydrilla/server/serve.py:110 +#: src/hydrilla/server/serve.py:122 #, python-brace-format msgid "uuid_mismatch_{identifier}" msgstr "Two different uuids were specified for item '{identifier}'." -#: src/hydrilla/server/serve.py:117 +#: src/hydrilla/server/serve.py:129 #, python-brace-format msgid "version_clash_{identifier}_{version}" msgstr "Version '{version}' specified more than once for item '{identifier}'." -#: src/hydrilla/server/serve.py:233 src/hydrilla/server/serve.py:245 +#: src/hydrilla/server/serve.py:245 src/hydrilla/server/serve.py:257 msgid "invalid_URL_{}" msgstr "Invalid URL/pattern: '{}'." -#: src/hydrilla/server/serve.py:237 +#: src/hydrilla/server/serve.py:249 msgid "disallowed_protocol_{}" msgstr "Disallowed protocol: '{}'." -#: src/hydrilla/server/serve.py:290 +#: src/hydrilla/server/serve.py:302 msgid "malcontent_dir_path_not_dir_{}" msgstr "Provided 'malcontent_dir' path does not name a directory: {}" -#: src/hydrilla/server/serve.py:309 +#: src/hydrilla/server/serve.py:321 msgid "couldnt_load_item_from_{}" msgstr "Couldn't load item from {}." -#: src/hydrilla/server/serve.py:335 +#: src/hydrilla/server/serve.py:347 msgid "item_{item}_in_file_{file}" msgstr "Item {item} incorrectly present under {file}." -#: src/hydrilla/server/serve.py:341 +#: src/hydrilla/server/serve.py:353 msgid "item_version_{ver}_in_file_{file}" msgstr "Item version {ver} incorrectly present under {file}." -#: src/hydrilla/server/serve.py:364 +#: src/hydrilla/server/serve.py:376 msgid "no_dep_{resource}_{ver}_{dep}" msgstr "Unknown dependency '{dep}' of resource '{resource}', version '{ver}'." -#: src/hydrilla/server/serve.py:375 +#: src/hydrilla/server/serve.py:387 msgid "no_payload_{mapping}_{ver}_{payload}" msgstr "Unknown payload '{payload}' of mapping '{mapping}', version '{ver}'." -#: src/hydrilla/server/serve.py:401 +#: src/hydrilla/server/serve.py:413 msgid "couldnt_register_{mapping}_{ver}_{pattern}" msgstr "" "Couldn't register mapping '{mapping}', version '{ver}' (pattern " "'{pattern}')." -#: src/hydrilla/server/serve.py:552 +#: src/hydrilla/server/serve.py:566 src/hydrilla/server/serve.py:588 +#, python-format +msgid "%(prog)s_%(version)s_license" +msgstr "" +"%(prog)s %(version)s\n" +"Copyright (C) 2021,2022 Wojtek Kosior and contributors.\n" +"License GPLv3+: GNU AGPL version 3 or later " +"<https://gnu.org/licenses/gpl.html>\n" +"This is free software: you are free to change and redistribute it.\n" +"There is NO WARRANTY, to the extent permitted by law." + +#: src/hydrilla/server/serve.py:577 msgid "directory_to_serve_from_overrides_config" msgstr "" "Directory to serve files from. Overrides value from the config file (if " "any)." -#: src/hydrilla/server/serve.py:554 +#: src/hydrilla/server/serve.py:579 msgid "project_url_to_display_overrides_config" msgstr "" "Project url to display on generated HTML pages. Overrides value from the " "config file (if any)." -#: src/hydrilla/server/serve.py:556 +#: src/hydrilla/server/serve.py:581 msgid "tcp_port_to_listen_on_overrides_config" msgstr "" "TCP port number to listen on (0-65535). Overrides value from the config " "file (if any)." -#: src/hydrilla/server/serve.py:559 +#: src/hydrilla/server/serve.py:584 msgid "path_to_config_file_explain_default" msgstr "" "Path to Hydrilla server configuration file (optional, by default Hydrilla" " loads its own config file, which in turn tries to load " "/etc/hydrilla/config.json)." -#: src/hydrilla/server/serve.py:561 +#: src/hydrilla/server/serve.py:586 msgid "language_to_use_overrides_config" msgstr "" "Language to use (also affects served HTML files). Overrides value from " "the config file (if any)." -#: src/hydrilla/server/serve.py:591 +#: src/hydrilla/server/serve.py:589 +msgid "version_printing" +msgstr "Print version information and exit." + +#: src/hydrilla/server/serve.py:617 msgid "config_option_{}_not_supplied" msgstr "Missing configuration option '{}'." -#: src/hydrilla/server/serve.py:595 +#: src/hydrilla/server/serve.py:621 msgid "serve_hydrilla_packages_explain_wsgi_considerations" msgstr "" "Serve Hydrilla packages.\n" 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: |