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

Impossible to parse --version from a script #334

Closed
kevinburke1 opened this issue Aug 21, 2020 · 4 comments · Fixed by #335
Closed

Impossible to parse --version from a script #334

kevinburke1 opened this issue Aug 21, 2020 · 4 comments · Fixed by #335

Comments

@kevinburke1
Copy link

Say I want to ensure that users are running a given postcss version from a Bash script, or say, ensuring everyone is running a version higher than 6. Normally you would do this by running <binary> --version and parsing the output. However, that's impossible (or much tougher, anyway) with postcss because this is the output that you get.

$ postcss --version

                                      /|\
                                    //   //
                                  //       //
                                //___*___*___//
                              //--*---------*--//
                            /|| *             * ||/
                          // ||*    v7.1.1     *|| //
                        //   || *             * ||   //
                      //_____||___*_________*___||_____//

I could write something that says "look for the fourth token in the sixth line" or something but that's extremely brittle. I also tried piping the output just to see if it would print something sane, but no, that also prints out version pyramid.

$ postcss --version | cat

                                      /|\
                                    //   //
                                  //       //
                                //___*___*___//
                              //--*---------*--//
                            /|| *             * ||/
                          // ||*    v7.1.1     *|| //
                        //   || *             * ||   //
                      //_____||___*_________*___||_____//

This is also frustrating to blind programmers with screen readers. I suggest you paste this output into Text Edit and then turn on VoiceOver for Mac... the output is roughly:

slash vertical bar forward slash slash slash slash slash slash slash slash slash slash slash underscore underscore underscore asterisk underscore underscore underscore asterisk underscore underscore underscore slash slash

and I'm only done with line 3. The version number will eventually print out on line 6.

I understand that it is amusing to print the version string in this way but please consider that users besides humans with working eyesight exist.

@RyanZim
Copy link
Collaborator

RyanZim commented Aug 24, 2020

Yah, this is cute, but not so great for machine readability. I didn't design this ASCII art, it was there when I started maintaining this package; @ai @michael-ciniawsky thoughts?

@michael-ciniawsky
Copy link
Contributor

Yeah it's just a stylistic addition. The moment it causes anyone the slightest bit of annoyance, it may be better to remove it imho ¯_(ツ)_/¯. Just logging the version is definitely the sanest approach here.

postcss --version | cat

should simply log

v7.1.1

RyanZim added a commit that referenced this issue Aug 26, 2020
@RyanZim
Copy link
Collaborator

RyanZim commented Aug 26, 2020

PR submitted: #335

RyanZim added a commit that referenced this issue Sep 1, 2020
@RyanZim
Copy link
Collaborator

RyanZim commented Sep 1, 2020

Published v7.1.2

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 a pull request may close this issue.

3 participants