Skip to content

Commit 4dd832f

Browse files
committed
refactor(cli): twig multiple lines
1 parent 60c2bd5 commit 4dd832f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

templates/cli/lib/commands/command.js.twig

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,21 @@ const {{ service.name | caseLower }} = new Command("{{ service.name | caseLower
5959
/**
6060
* @param {{ "{" }}{{ service.name | caseUcfirst }}{{ method.name | caseUcfirst }}RequestParams{{ "}" }} params
6161
*/
62-
const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({ {% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}, {% endfor %}parseOutput = true, overrideForCli = false, sdk = undefined{% if 'multipart/form-data' in method.consumes %}, onProgress = () => {}{% endif %}{% if method.type == 'location' %}, destination{% endif %}}) => {
63-
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} : sdk;
62+
{%~ block decleration -%}
63+
const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
64+
{%- for parameter in method.parameters.all -%}
65+
{{ parameter.name | caseCamel | escapeKeyword }},
66+
{%- endfor -%}
67+
68+
{%- block baseParams -%}parseOutput = true, overrideForCli = false, sdk = undefined {%- endblock -%}
69+
70+
{%- if 'multipart/form-data' in method.consumes -%},onProgress = () => {}{%- endif -%}
71+
72+
{%- if method.type == 'location' -%}, destination{%- endif -%}
73+
}) => {
74+
{%~ endblock %}
75+
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} :
76+
sdk;
6477
let apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};
6578
{{ include ('cli/base/params.twig') }}
6679
{% if 'multipart/form-data' in method.consumes %}

0 commit comments

Comments
 (0)