Skip to content

Commit

Permalink
refactor: reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
byawitz committed Jun 11, 2024
1 parent 11fe1ff commit 0e8c129
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion templates/cli/base/requests/api.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
fs.writeFileSync(destination, response);
{%~ endif %}
if (parseOutput) {
{%~ if methodHaveConsolePreview(method.name,service.name) %}
{%~ if hasConsolePreview(method.name,service.name) %}
if(console) {
showConsoleLink('{{service.name}}', '{{ method.name }}'
{%- for parameter in method.parameters.path -%}{%- set param = (parameter.name | caseCamel | escapeKeyword) -%}{%- if param ends with 'Id' -%}, {{ param }} {%- endif -%}{%- endfor -%}
Expand Down
4 changes: 2 additions & 2 deletions templates/cli/lib/commands/command.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
{%- if 'multipart/form-data' in method.consumes -%},onProgress = () => {}{%- endif -%}

{%- if method.type == 'location' -%}, destination{%- endif -%}
{% if methodHaveConsolePreview(method.name,service.name) %}, console{%- endif -%}
{% if hasConsolePreview(method.name,service.name) %}, console{%- endif -%}
}) => {
{%~ endblock %}
let client = !sdk ? await {% if service.name == "projects" %}sdkForConsole(){% else %}sdkForProject(){% endif %} :
Expand All @@ -95,7 +95,7 @@ const {{ service.name | caseLower }}{{ method.name | caseUcfirst }} = async ({
{% if method.type == 'location' %}
.requiredOption(`--destination <path>`, `output file path.`)
{% endif %}
{% if methodHaveConsolePreview(method.name,service.name) %}
{% if hasConsolePreview(method.name,service.name) %}
.option(`--console`, `Get the resource console url`)
{% endif %}
{% endautoescape %}
Expand Down
6 changes: 3 additions & 3 deletions templates/cli/lib/commands/generic.js.twig
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ const logout = new Command("logout")
}
}

const leftSessions = globalConfig.getSessions();
const remainingSessions = globalConfig.getSessions();

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

success(`Current account is ${accountId}`);
Expand Down
4 changes: 1 addition & 3 deletions templates/cli/lib/utils.js.twig
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const fs = require("fs");
const path = require("path");
const { localConfig, globalConfig } = require("./config");
const { success, log, error } = require('./parser')
const readline = require('readline');
const cp = require('child_process');
const { success } = require('./parser')

function getAllFiles(folder) {
const files = [];
Expand Down

0 comments on commit 0e8c129

Please sign in to comment.