Skip to content

Commit 0e8c129

Browse files
committed
refactor: reviews
1 parent 11fe1ff commit 0e8c129

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

templates/cli/base/requests/api.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
fs.writeFileSync(destination, response);
1818
{%~ endif %}
1919
if (parseOutput) {
20-
{%~ if methodHaveConsolePreview(method.name,service.name) %}
20+
{%~ if hasConsolePreview(method.name,service.name) %}
2121
if(console) {
2222
showConsoleLink('{{service.name}}', '{{ method.name }}'
2323
{%- for parameter in method.parameters.path -%}{%- set param = (parameter.name | caseCamel | escapeKeyword) -%}{%- if param ends with 'Id' -%}, {{ param }} {%- endif -%}{%- endfor -%}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
7070
{%- if 'multipart/form-data' in method.consumes -%},onProgress = () => {}{%- endif -%}
7171

7272
{%- if method.type == 'location' -%}, destination{%- endif -%}
73-
{% if methodHaveConsolePreview(method.name,service.name) %}, console{%- endif -%}
73+
{% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%}
7474
}) => {
7575
{%~ endblock %}
7676
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} :
@@ -95,7 +95,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
9595
{% if method.type == 'location' %}
9696
.requiredOption(`--destination <path>`, `output file path.`)
9797
{% endif %}
98-
{% if methodHaveConsolePreview(method.name,service.name) %}
98+
{% if hasConsolePreview(method.name,service.name) %}
9999
.option(`--console`, `Get the resource console url`)
100100
{% endif %}
101101
{% endautoescape %}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ const logout = new Command("logout")
186186
}
187187
}
188188

189-
const leftSessions = globalConfig.getSessions();
189+
const remainingSessions = globalConfig.getSessions();
190190

191-
if (leftSessions.length > 0 && leftSessions.filter(session => session.id === current).length !== 1) {
192-
const accountId = leftSessions[0].id;
191+
if (remainingSessions .length > 0 && remainingSessions .filter(session => session.id === current).length !== 1) {
192+
const accountId = remainingSessions [0].id;
193193
globalConfig.setCurrentSession(accountId);
194194

195195
success(`Current account is ${accountId}`);

templates/cli/lib/utils.js.twig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const fs = require("fs");
22
const path = require("path");
33
const { localConfig, globalConfig } = require("./config");
4-
const { success, log, error } = require('./parser')
5-
const readline = require('readline');
6-
const cp = require('child_process');
4+
const { success } = require('./parser')
75

86
function getAllFiles(folder) {
97
const files = [];

0 commit comments

Comments
 (0)