From f76482b6b55ced844cca9f8eab5157b7f53745e9 Mon Sep 17 00:00:00 2001 From: kai ru Date: Mon, 5 Aug 2024 16:17:49 +0800 Subject: [PATCH] Escape backslashes in examples --- src/aaz_dev/cli/templates/aaz/command/_cmd.py.j2 | 6 +++--- src/aaz_dev/cli/templates/aaz/group/__cmd_group.py.j2 | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/aaz_dev/cli/templates/aaz/command/_cmd.py.j2 b/src/aaz_dev/cli/templates/aaz/command/_cmd.py.j2 index e600f429..7e301da3 100644 --- a/src/aaz_dev/cli/templates/aaz/command/_cmd.py.j2 +++ b/src/aaz_dev/cli/templates/aaz/command/_cmd.py.j2 @@ -34,17 +34,17 @@ class {{ leaf.cls_name }}( AAZCommand {%- endif -%} ): - """{{ leaf.help.short|replace('\\', '\\\\') }} + """{{ leaf.help.short | replace('\\', '\\\\') }} {%- if leaf.help.long is not none and leaf.help.long|length %} - {{ leaf.help.long.split('\n')|join('\n ')|replace('\\', '\\\\') }} + {{ leaf.help.long.split('\n') | join('\n ') | replace('\\', '\\\\') }} {%- endif %} {%- if leaf.help.examples is not none and leaf.help.examples|length %} {%- for example in leaf.help.examples %} :example: {{ example.name }} {%- for command in example.commands %} - az {{ command }} + az {{ command | replace('\\', '\\\\') }} {%- endfor %} {%- endfor %} {%- endif %} diff --git a/src/aaz_dev/cli/templates/aaz/group/__cmd_group.py.j2 b/src/aaz_dev/cli/templates/aaz/group/__cmd_group.py.j2 index 0a17f52c..b07b4a68 100644 --- a/src/aaz_dev/cli/templates/aaz/group/__cmd_group.py.j2 +++ b/src/aaz_dev/cli/templates/aaz/group/__cmd_group.py.j2 @@ -22,10 +22,10 @@ from azure.cli.core.aaz import * ) {%- endif %} class __CMDGroup(AAZCommandGroup): - """{{ node.help.short|replace('\\', '\\\\') }} + """{{ node.help.short | replace('\\', '\\\\') }} {%- if node.help.long is not none and node.help.long|length %} - {{ node.help.long.split('\n')|join('\n ')|replace('\\', '\\\\') }} + {{ node.help.long.split('\n') | join('\n ') | replace('\\', '\\\\') }} {%- endif %} """ pass