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

Pretty Print disables when used #2

Closed
erikreinert opened this issue Dec 17, 2020 · 4 comments
Closed

Pretty Print disables when used #2

erikreinert opened this issue Dec 17, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@erikreinert
Copy link

Expected Behavior

When using the --pretty-print argument - it should stay enabled and output something like this:

{
  "data": [
    {
      "broadcaster_type": "affiliate",
      "created_at": "2018-10-01T15:26:44.113951Z",
      "description": "The Alt-F4 Stream is an idea long time friends AT0TA and Blackglasses had of being able to game/stream together miles apart. We are real life friends that met long ago in a little town in Florida and kept our friendship over the years through video games. Find out more about us below!",
      "display_name": "TheAltF4Stream",
     ....
    }
  ]
}

Actual Behavior

It appears to be disabling the flag when used instead of keeping it enabled rendering non-pretty output:

{"data":[{"id":"264030156","login":"thealtf4stream","display_name":"TheAltF4Stream","type":"","broadcaster_type":"affiliate","description":"The Alt-F4 Stream is an idea long time friends AT0TA and Blackglasses had of being able to game/stream together miles apart. We are real life friends that met long ago in a little town in Florida and kept our friendship over the years through video games. Find out more about us below!","profile_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/ffedad62-cc6e-497f-8eef-61e7fec4c9b4-profile_image-300x300.png","offline_image_url":"https://static-cdn.jtvnw.net/jtv_user_pictures/ce008d9e-a92f-4781-a2d0-4bba41061812-channel_offline_image-1920x1080.png","view_count":95898,"created_at":"2018-10-01T15:26:44.113951Z"}]}

Steps to Reproduce the Problem

  1. Use the following command as an example and make sure --pretty-print is included.
twitch-cli api --pretty-print get users -q login=thealtf4stream
  1. Should return a non-pretty output of your query.

Specifications

  • Version: Beta Version 0.1.0
  • Platform: Linux
@lleadbet
Copy link
Contributor

Hi there!

You hit the nail on the head. It's a poorly named flag, so I may just need to rename it, but it's defaulted on and using it toggles it off.

I'll dig into this and see the better solve here.

@lleadbet lleadbet added the bug Something isn't working label Dec 17, 2020
@Soupertonic
Copy link

Soupertonic commented Dec 18, 2020

I don't seem to understand the issue in the code. The boolean is getting inverted and that is accompanied with this comment:
// default here is false to enable -p commands to toggle off without explicitly defining -p=false as -p false will not work. The below commands invert the bool to pass the true default.

I've been running some tests and everything seems to be working just fine without the invert. Let me show you. For debugging purposes the command now also outputs the pretty-print condition.

No pretty print (-p and --pretty-print absent)
grafik

Pretty print (-p specified, --pretty-print absent)
grafik

Pretty print (-p absent, --pretty-print specified)
grafik

Pretty print (-p and --pretty-print specified)
grafik

I'm missing some intel. Is pretty print supposed to be enabled by default and you have to explicitly specify a flag to disable pretty print?

EDIT

Is this the wanted behavior? You have to explicitly specify --unformatted, -u to disable pretty print. I think that's the desired solution because most people just wanna see the data. If they still wanna pipe the output they can use --unformatted.

grafik

grafik

@Soupertonic
Copy link

All it boils down to is to rename the pretty-print flag to unformatted. 😃

lleadbet added a commit that referenced this issue Dec 20, 2020
Addressing #2, #3, #4.
@lleadbet
Copy link
Contributor

Followup, this has a fix merged but isn't in a release just yet. I'll make sure that I followup once we cut a release.

@lleadbet lleadbet added the awaiting release A fix is merged into main, but needs a release cut. label Dec 30, 2020
@lleadbet lleadbet removed the awaiting release A fix is merged into main, but needs a release cut. label Jan 6, 2021
@lleadbet lleadbet closed this as completed Jan 6, 2021
Xemdo added a commit that referenced this issue Feb 28, 2023
* Fix dependabot alerts 2, 3, and 4; Update project to Go 1.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants