jbcarpanelli / spinnies

Node.js module to create and manage multiple spinners in command-line interface programs
MIT License
147 stars 32 forks source link

indent option #15

Closed rap2hpoutre closed 4 years ago

rap2hpoutre commented 4 years ago

Added indent option. Fixes https://github.com/jcarpanelli/spinnies/issues/14

Capture d’écran 2019-07-24 à 11 12 46
SweetMNM commented 4 years ago

If you try to indent a multi-line text spinner everything breaks. Try using the indent option on the spinner that would love to make some friends and see for yourself. The problem is getLinesLength and breakText don't take the indent option into consideration.

Edit: getLinesLength does take indent into consideration the problem is with breakText. breakText is not aware of the extra spaces which will result in the text breaking at the wrong spot.

Also multi-line strings should have all lines indented.

jbcarpanelli commented 4 years ago

Hello, @rap2hpoutre! Sorry for the super late response! I just came back from vacations! I'll review this PR by the end of the weekend :slightly_smiling_face:.

rap2hpoutre commented 4 years ago

I fixed the multiline problem thanks to @SweetMNM comment (in ac1a4b0)

@jcarpanelli You could now retry, it works for me (even with multi-line).

rap2hpoutre commented 4 years ago

@jcarpanelli I added some tests in this commit: d515657. Let me know if it' OK for you

rap2hpoutre commented 4 years ago

@jcarpanelli 👍 Thank you! When do you plan to release it?

jbcarpanelli commented 4 years ago

Hey @rap2hpoutre! I've just published v0.5.0 :slightly_smiling_face:

rap2hpoutre commented 4 years ago

Thank you!!