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

Invalid JSON produced by apps:create #38

Open
adriantoll opened this issue Mar 29, 2022 · 4 comments
Open

Invalid JSON produced by apps:create #38

adriantoll opened this issue Mar 29, 2022 · 4 comments

Comments

@adriantoll
Copy link

adriantoll commented Mar 29, 2022

When using atomic apps:create the output includes this line at the end:

[apps:create] Time: 8.48 seconds, Memory: 6.00mb

This makes the output invalid JSON and cause jq to give an invalid string literal error when the output is passed as a variable like this:

app_json_object=$( atomic apps:create "$account_id" "$site_url" "$site_url" )

app_id=$( jq '.[ "id" ]' <<< "$app_json_object" )

I think that last line shouldn't be added to the output, perhaps only being added if a some kind of a debug flag is used.

@pgibson1-godaddy
Copy link
Contributor

Thanks @adriantoll - you can suppress this message with --hide-resource-info.

@adriantoll
Copy link
Author

Thanks @pgibson1-godaddy but wouldn't it make sense to do this the other way around with something like --verbose so that the default is to produce value JSON? I imagine that the vast majority of uses cases are for automation, so producing something by default that can't be used for automation seems the wrong way around.

@pgibson1-godaddy
Copy link
Contributor

pgibson1-godaddy commented Jul 8, 2022

Thanks @pgibson1-godaddy but wouldn't it make sense to do this the other way around with something like --verbose so that the default is to produce value JSON? I imagine that the vast majority of uses cases are for automation, so producing something by default that can't be used for automation seems the wrong way around.

In general I agree although I think the issue is we are including a third party package to print these statistics, and the only time they are turned off is when you use --hide-resource-info or when you use --quiet (which will then not show the JSON).

While atomic-client can be used programmatically like this (executing the commands and parsing their responses), in a lot of cases the commands in the client are being used as a template in order to understand how to interface directly with the methods within PHP code. For example, you would be calling AppsClient->createApps() directly in your PHP code.

I will however reopen the issue in case we want to investigate dropping this debugging package in the future.

@adriantoll
Copy link
Author

@pgibson1-godaddy OK, thanks.

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

No branches or pull requests

2 participants