From 5d7a87afb0f1e38000231158d3a6d40c2f1ddcc8 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Wed, 3 Oct 2018 19:39:10 +0200 Subject: [PATCH] show_help() --- bin/srv.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/srv.py b/bin/srv.py index 75c9f9a..8bfae5a 100644 --- a/bin/srv.py +++ b/bin/srv.py @@ -274,8 +274,19 @@ def find_supported_language(accepted_languages): return lang return None -def show_help(): - return open(HELP_FILE, 'r').read() +def show_help(location, lang): + text = "" + if location == ":help": + text = open(get_help_file(lang), 'r').read() + text = text.replace('FULL_TRANSLATION', ' '.join(FULL_TRANSLATION)) + text = text.replace('PARTIAL_TRANSLATION', ' '.join(PARTIAL_TRANSLATION)) + elif location == ":bash.function": + text = open(BASH_FUNCTION_FILE, 'r').read() + elif location == ":translation": + text = open(TRANSLATION_FILE, 'r').read() + text = text.replace('NUMBER_OF_LANGUAGES', str(len(SUPPORTED_LANGS))).replace('SUPPORTED_LANGUAGES', ' '.join(SUPPORTED_LANGS)) + return text.decode('utf-8') +show_help.pages = [':help', ':bash.function', ':translation' ] @app.route('/files/') def send_static(path):