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

$cli->json() not working as expected #34

Open
S1SYPHOS opened this issue Jan 7, 2023 · 3 comments
Open

$cli->json() not working as expected #34

S1SYPHOS opened this issue Jan 7, 2023 · 3 comments
Milestone

Comments

@S1SYPHOS
Copy link

S1SYPHOS commented Jan 7, 2023

Hey there,
looking at the CLImate docs linked in README.md, one would expect that $cli->json($myJson) (eg inside a custom command) outputs JSON into the terminal - but all it does is return json_encoded data, which then needs to be output to the terminal, like this: $cli->out($cli->json($myJson)) - which is not desired behaviour from the looks of it.

In order to comply with aforementioned docs, PR #33 attempts to solve this.

Cheers,
S1SYPHOS

@S1SYPHOS
Copy link
Author

Anyone there? 😭

@bastianallgeier
Copy link
Member

Sorry for the massive delay. I think you are right that this should work in the same way as the climate method. I've added it as a general helper to create json from arrays without automatically dumping it. If we change it like in your PR it would be a breaking change.

@bastianallgeier
Copy link
Member

I looked at it again and it's really one of those wrong decisions that are difficult to undo. I think we need to have a 2.0.0 for this. So far you can still use $cli->climate()->json() to get the behaviour you are looking for.

@bastianallgeier bastianallgeier added this to the 2.0.0 milestone Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants