-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): Adding console for get & list methods #849
Conversation
…accounts-and-instances
Feat general improvements
Feat function init improvments
Feat arg project init
…nces' into feat-multiple-accounts-and-instances # Conflicts: # templates/cli/lib/commands/push.js.twig # templates/cli/lib/config.js.twig
@@ -94,6 +95,10 @@ 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) %} | |||
.option(`--console`, `Get the resource console url`) | |||
.option(`--open`, `Use with '--console' to open the using default browser`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when we will merge the one after
…ances Feat multiple accounts and instances
src/SDK/Language/CLI.php
Outdated
{ | ||
return [ | ||
/** Return true if the entered service->method is enabled for a console preview link */ | ||
new TwigFunction('methodHaveConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new TwigFunction('methodHaveConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method) | |
new TwigFunction('hasConsolePreview', fn($method, $service) => preg_match('/^([Gg]et|[Ll]ist)/', $method) |
templates/cli/base/requests/api.twig
Outdated
@@ -17,8 +17,19 @@ | |||
fs.writeFileSync(destination, response); | |||
{%~ endif %} | |||
if (parseOutput) { | |||
{%~ if methodHaveConsolePreview(method.name,service.name) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{%~ if methodHaveConsolePreview(method.name,service.name) %} | |
{%~ if hasConsolePreview(method.name,service.name) %} |
globalConfig.setCurrentSession(accountId); | ||
await deleteSession(accountId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are setting the current session to an accountID and deleting that specific one? Which means all new requests will throw 401 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're setting the current session to the last account in line using the leftSession
variable right after.
What does this PR do?
Added
--console
flag to open resources at project console.Test Plan