Skip to content

Commit ad4df0f

Browse files
committed
chore: fix commands
1 parent 58ae394 commit ad4df0f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/SDK/Language/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public function getFilters(): array
433433
{
434434
return array_merge(parent::getFilters(), [
435435
new TwigFilter('caseKebab', function ($value) {
436-
return strtolower(preg_replace('/(?<!^)([A-Z][a-z]|(?<=[a-z])[^a-z]|(?<=[A-Z])[0-9_])/', '-$1', $value));
436+
return strtolower(preg_replace('/(?<!^)([A-Z][a-z]|(?<=[a-z])[^a-z\s]|(?<=[A-Z])[0-9_])/', '-$1', $value));
437437
})
438438
]);
439439
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const {{ service.name | caseLower }} = new Command("{{ service.name | caseLower
5959
/**
6060
* @param {{ "{" }}{{ service.name | caseUcfirst }}{{ method.name | caseUcfirst }}RequestParams{{ "}" }} params
6161
*/
62-
{% block decleration %}
62+
{% block declaration %}
6363
const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
6464
{%- for parameter in method.parameters.all -%}
6565
{{ parameter.name | caseCamel | escapeKeyword }},
@@ -74,7 +74,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
7474
}) => {
7575
{% if method.deprecated %}
7676
{% if method.since and method.replaceWith %}
77-
console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) }}" instead.{% endif %}');
77+
console.warn('Warning: This command is deprecated since {{ method.since }}.{% if method.replaceWith %} Please use "{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}" instead.{% endif %}');
7878
{% else %}
7979
console.warn('Warning: This command is deprecated.');
8080
{% endif %}
@@ -88,14 +88,14 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
8888
{{ include('cli/base/requests/api.twig') }}
8989
{% endif %}
9090
}
91-
{% endblock %}
91+
{% endblock declaration %}
9292

9393
{% endfor %}
9494
{% for method in service.methods %}
9595
{{service.name | caseLower }}
9696
.command(`{{ method.name | caseKebab }}`)
9797
{% autoescape false %}
98-
.description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`)
98+
.description(`{% if method.deprecated %}[DEPRECATED] This command is deprecated.{% if method.replaceWith %} Please use '{{ method.replaceWith | replace({'.': ' '}) | caseKebab }}' instead.{% endif %} {% endif %}{{ method.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`)
9999
{% for parameter in method.parameters.all %}
100100
.{% if parameter.required and not parameter.nullable %}requiredOption{% else %}option{% endif %}(`--{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter | typeName == 'boolean' %} [value]{% else %} {% if parameter.array.type|length > 0 %}[{% else %}<{% endif %}{{ parameter.name | escapeKeyword | caseKebab }}{% if parameter.array.type|length > 0 %}...{% endif %}{% if parameter.array.type|length > 0 %}]{% else %}>{% endif %}{% endif %}`, `{{ parameter.description | replace({'`':'\''}) | replace({'\n':' '}) | replace({'\n \n':' '}) }}`{% if parameter | typeName == 'boolean' %}, (value) => value === undefined ? true : parseBool(value){% elseif parameter | typeName == 'number' %}, parseInteger{% endif %})
101101
{% endfor %}

0 commit comments

Comments
 (0)