Skip to content
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

Merged
merged 132 commits into from
Jun 11, 2024

Conversation

byawitz
Copy link
Member

@byawitz byawitz commented May 21, 2024

What does this PR do?

Added --console flag to open resources at project console.

Test Plan

image

Base automatically changed from feat-pull-function to feat-create-resources May 22, 2024 13:05
@@ -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`)
Copy link
Member

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?

Copy link
Member Author

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

{
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

@@ -17,8 +17,19 @@
fs.writeFileSync(destination, response);
{%~ endif %}
if (parseOutput) {
{%~ if methodHaveConsolePreview(method.name,service.name) %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{%~ if methodHaveConsolePreview(method.name,service.name) %}
{%~ if hasConsolePreview(method.name,service.name) %}

Comment on lines +184 to +185
globalConfig.setCurrentSession(accountId);
await deleteSession(accountId);
Copy link
Member

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 ?

Copy link
Member Author

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.

@christyjacob4 christyjacob4 merged commit 2014675 into feat-cli-g2 Jun 11, 2024
35 checks passed
@christyjacob4 christyjacob4 deleted the feat-console-flow branch June 11, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants