mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] extract manpage template in another file
This commit is contained in:
parent
fb815d8f3e
commit
78391045d8
2 changed files with 93 additions and 94 deletions
|
@ -16,100 +16,7 @@ from collections import OrderedDict
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
template = Template('''\
|
template = Template(open("./manpage.template").read())
|
||||||
.TH YunoHost "1" "{{ month }} {{ year }}" "YunoHost Collectif"
|
|
||||||
.SH NAME
|
|
||||||
YunoHost \\- yunohost server administration command
|
|
||||||
|
|
||||||
.SH SYNOPSIS
|
|
||||||
yunohost \\fI\\,CATEGORY\\/\\fR \\fI\\,COMMAND\\/\\fR [\\fI\\,SUBCOMMAND\\/\\fR] [\\fI\\,ARGUMENTS\\/\\fR]... [\\fI\\,OPTIONS\\/\\fR]...
|
|
||||||
|
|
||||||
{# generale command format #}
|
|
||||||
.SH DESCRIPTION
|
|
||||||
usage: yunohost
|
|
||||||
{{ '{' }}{{ ",".join(categories) }}{{ '}' }}
|
|
||||||
\\&...
|
|
||||||
[\\-h|\\-\\-help] [\\-\\-no\\-cache] [\\-\\-output\\-as {json,plain,none}] [\\-\\-debug]
|
|
||||||
[\\-\\-quiet] [\\-\\-timeout ==SUPPRESS==] [\\-\\-admin\\-password PASSWORD]
|
|
||||||
[\\-v|\\-\\-version]
|
|
||||||
|
|
||||||
.SS "optional arguments:"
|
|
||||||
.TP
|
|
||||||
\\fB\\-h\\fR, \\fB\\-\\-help\\fR
|
|
||||||
show this help message and exit
|
|
||||||
|
|
||||||
.SS "categories:"
|
|
||||||
.IP
|
|
||||||
{{ '{' }}{{ ",".join(categories) }}{{ '}' }}
|
|
||||||
{% for name, value in categories.items() %}
|
|
||||||
.TP
|
|
||||||
{{ name }}
|
|
||||||
{{ value["category_help"] }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
.SS "global arguments:"
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-no\\-cache\\fR
|
|
||||||
Don't use actions map cache
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-output\\-as\\fR {json,plain,none}
|
|
||||||
Output result in another format
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-debug\\fR
|
|
||||||
Log and print debug messages
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-quiet\\fR
|
|
||||||
Don't produce any output
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-timeout\\fR SECONDS
|
|
||||||
Number of seconds before this command will timeout
|
|
||||||
because it can't acquire the lock (meaning that
|
|
||||||
another command is currently running), by default
|
|
||||||
there is no timeout and the command will wait until it
|
|
||||||
can get the lock
|
|
||||||
.TP
|
|
||||||
\\fB\\-\\-admin\\-password\\fR PASSWORD
|
|
||||||
The admin password to use to authenticate
|
|
||||||
.TP
|
|
||||||
\\fB\\-v\\fR, \\fB\\-\\-version\\fR
|
|
||||||
Display YunoHost packages versions
|
|
||||||
|
|
||||||
{# each categories #}
|
|
||||||
{% for name, value in categories.items() %}
|
|
||||||
.SH YUNOHOST {{ name.upper() }}
|
|
||||||
usage: yunohost {{ name }} {{ '{' }}{{ ",".join(value["actions"].keys()) }}{{ '}' }}
|
|
||||||
\\&...
|
|
||||||
.SS "description:"
|
|
||||||
.IP
|
|
||||||
{{ value["category_help"] }}
|
|
||||||
|
|
||||||
{# each command of each category #}
|
|
||||||
{% for action, action_value in value["actions"].items() %}
|
|
||||||
.SS "yunohost {{ name }} {{ action }} \
|
|
||||||
{% for argument_name, argument_value in action_value.get("arguments", {}).items() %}\
|
|
||||||
{% set required=(not str(argument_name).startswith("-")) or argument_value.get("extra", {}).get("required", False) %}\
|
|
||||||
{% if not required %}[{% endif %}\
|
|
||||||
\\fI\\,{{ argument_name }}\\/\\fR{% if argument_value.get("full") %}|\\fI\\,{{ argument_value["full"] }}\\fR{% endif %}\
|
|
||||||
{% if str(argument_name).startswith("-") and not argument_value.get("action") == "store_true" %} {{ (argument_value.get("full", argument_name)).lstrip("-") }}{% endif %}\
|
|
||||||
{% if not required %}]{% endif %} \
|
|
||||||
{% endfor %}"
|
|
||||||
|
|
||||||
{# help of the command #}
|
|
||||||
{{ action_value["action_help"] }}
|
|
||||||
|
|
||||||
{# arguments of the command #}
|
|
||||||
{% if "arguments" in action_value %}
|
|
||||||
{% for argument_name, argument_value in action_value["arguments"].items() %}
|
|
||||||
.TP
|
|
||||||
\\fB{{ argument_name }}\\fR{% if argument_value.get("full") %}, \\fB{{ argument_value["full"] }}\\fR{% endif %}\
|
|
||||||
{% if str(argument_name).startswith("-") and not argument_value.get("action") == "store_true" %} \\fI\\,{{ (argument_value.get("full", argument_name)).lstrip("-") }}\\fR {% if "default" in argument_value %}(default: {{ argument_value["default"] }}){% endif %}{% endif %}
|
|
||||||
{{ argument_value.get("help", "")}}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
''')
|
|
||||||
|
|
||||||
|
|
||||||
THIS_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
THIS_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
92
doc/manpage.template
Normal file
92
doc/manpage.template
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
.TH YunoHost "1" "{{ month }} {{ year }}" "YunoHost Collectif"
|
||||||
|
.SH NAME
|
||||||
|
YunoHost \- yunohost server administration command
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
yunohost \fI\,CATEGORY\/\fR \fI\,COMMAND\/\fR [\fI\,SUBCOMMAND\/\fR] [\fI\,ARGUMENTS\/\fR]... [\fI\,OPTIONS\/\fR]...
|
||||||
|
|
||||||
|
{# generale command format #}
|
||||||
|
.SH DESCRIPTION
|
||||||
|
usage: yunohost
|
||||||
|
{{ '{' }}{{ ",".join(categories) }}{{ '}' }}
|
||||||
|
\&...
|
||||||
|
[\-h|\-\-help] [\-\-no\-cache] [\-\-output\-as {json,plain,none}] [\-\-debug]
|
||||||
|
[\-\-quiet] [\-\-timeout ==SUPPRESS==] [\-\-admin\-password PASSWORD]
|
||||||
|
[\-v|\-\-version]
|
||||||
|
|
||||||
|
.SS "optional arguments:"
|
||||||
|
.TP
|
||||||
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
|
show this help message and exit
|
||||||
|
|
||||||
|
.SS "categories:"
|
||||||
|
.IP
|
||||||
|
{{ '{' }}{{ ",".join(categories) }}{{ '}' }}
|
||||||
|
{% for name, value in categories.items() %}
|
||||||
|
.TP
|
||||||
|
{{ name }}
|
||||||
|
{{ value["category_help"] }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
.SS "global arguments:"
|
||||||
|
.TP
|
||||||
|
\fB\-\-no\-cache\fR
|
||||||
|
Don't use actions map cache
|
||||||
|
.TP
|
||||||
|
\fB\-\-output\-as\fR {json,plain,none}
|
||||||
|
Output result in another format
|
||||||
|
.TP
|
||||||
|
\fB\-\-debug\fR
|
||||||
|
Log and print debug messages
|
||||||
|
.TP
|
||||||
|
\fB\-\-quiet\fR
|
||||||
|
Don't produce any output
|
||||||
|
.TP
|
||||||
|
\fB\-\-timeout\fR SECONDS
|
||||||
|
Number of seconds before this command will timeout
|
||||||
|
because it can't acquire the lock (meaning that
|
||||||
|
another command is currently running), by default
|
||||||
|
there is no timeout and the command will wait until it
|
||||||
|
can get the lock
|
||||||
|
.TP
|
||||||
|
\fB\-\-admin\-password\fR PASSWORD
|
||||||
|
The admin password to use to authenticate
|
||||||
|
.TP
|
||||||
|
\fB\-v\fR, \fB\-\-version\fR
|
||||||
|
Display YunoHost packages versions
|
||||||
|
|
||||||
|
{# each categories #}
|
||||||
|
{% for name, value in categories.items() %}
|
||||||
|
.SH YUNOHOST {{ name.upper() }}
|
||||||
|
usage: yunohost {{ name }} {{ '{' }}{{ ",".join(value["actions"].keys()) }}{{ '}' }}
|
||||||
|
\&...
|
||||||
|
.SS "description:"
|
||||||
|
.IP
|
||||||
|
{{ value["category_help"] }}
|
||||||
|
|
||||||
|
{# each command of each category #}
|
||||||
|
{% for action, action_value in value["actions"].items() %}
|
||||||
|
.SS "yunohost {{ name }} {{ action }} \
|
||||||
|
{% for argument_name, argument_value in action_value.get("arguments", {}).items() %}\
|
||||||
|
{% set required=(not str(argument_name).startswith("-")) or argument_value.get("extra", {}).get("required", False) %}\
|
||||||
|
{% if not required %}[{% endif %}\
|
||||||
|
\fI\,{{ argument_name }}\/\fR{% if argument_value.get("full") %}|\fI\,{{ argument_value["full"] }}\fR{% endif %}\
|
||||||
|
{% if str(argument_name).startswith("-") and not argument_value.get("action") == "store_true" %} {{ (argument_value.get("full", argument_name)).lstrip("-") }}{% endif %}\
|
||||||
|
{% if not required %}]{% endif %} \
|
||||||
|
{% endfor %}"
|
||||||
|
|
||||||
|
{# help of the command #}
|
||||||
|
{{ action_value["action_help"] }}
|
||||||
|
|
||||||
|
{# arguments of the command #}
|
||||||
|
{% if "arguments" in action_value %}
|
||||||
|
{% for argument_name, argument_value in action_value["arguments"].items() %}
|
||||||
|
.TP
|
||||||
|
\fB{{ argument_name }}\fR{% if argument_value.get("full") %}, \fB{{ argument_value["full"] }}\fR{% endif %}\
|
||||||
|
{% if str(argument_name).startswith("-") and not argument_value.get("action") == "store_true" %} \fI\,{{ (argument_value.get("full", argument_name)).lstrip("-") }}\fR {% if "default" in argument_value %}(default: {{ argument_value["default"] }}){% endif %}{% endif %}
|
||||||
|
{{ argument_value.get("help", "")}}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
Loading…
Add table
Reference in a new issue