Giter Site home page Giter Site logo

Remove speech bubble from ascii about cowsay HOT 17 OPEN

sckott avatar sckott commented on June 13, 2024
Remove speech bubble from ascii

from cowsay.

Comments (17)

sckott avatar sckott commented on June 13, 2024

forces speech bubbles within the elements of the animals object

can you clarify? not sure what you mean

from cowsay.

oganm avatar oganm commented on June 13, 2024

You define an animal as

---
%s
---
 \
  \
   animal

Which means the speech bubble will look the same no matter what the input text is. For instance

---
extremely long input that this bubble is clearly not designed for
---
 \
  \
   animal

While if instead animals were defined as

%s
   \
    \
     animal

You could replace the entire speech bubble with one that looks appropriate to the input size.

 _________________________________________________________________________
< extremely long input in a bubble created based on input character count >
 -------------------------------------------------------------------------
 \
  \
   animal

from cowsay.

sckott avatar sckott commented on June 13, 2024

Okay.

My cli cowsay has vertical bars instead of carrots, not important really, but just to show you

lorem -s 5 | cowsay
 _________________________________________
/ Lorem ipsum dolor sit amet,             \
| consectetuer adipiscing elit! Aenean    |
| commodo ligula eget dolor? Aenean       |
| massa; Cum sociis natoque penatibus et  |
| magnis dis parturient montes, nascetur  |
| ridiculus mus? Donec quam felis,        |
| ultricies nec, pellentesque eu, pretium |
\ quis, sem!                              /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

I think making this the default would be good. it'd be good to have the bubble envelop the entire string

wrt letting the user specify, can you give a use case? and might it be difficult for the user to know how to give the bubble? i guess you could present options for the bubble that are a set that we know work well.

from cowsay.

sckott avatar sckott commented on June 13, 2024

any thoughts on this @oganm ? do you want to submit a PR?

opinions @aedobbyn ? do you want this change or no?

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Interesting idea! I think I like it.

@sckott's cli cowsay I think looks good because it's more compact than the full width of the terminal.

As far as implementing something like that, for the top and bottom of the bubble I guess you'd just make a line measured by something like

min(options("width")$width, some_max_width)

to ensure that some_max_width isn't greater than the user's console width, where either we or the user determine some_max_width.

Then add |s for all lines except the first and last, which get / and \.

As far as splitting the text up into lines I'm not totally sure but I don't think you wouldn't want to split up the text exactly evenly because that would spread words across multiple lines. So you'd probably want to go with splitting on the last space character without going over min(options("width")$width, some_max_width). Does that sound about like what you had in mind @oganm?

from cowsay.

oganm avatar oganm commented on June 13, 2024

Not sure how much it should be based on the terminal size as it might get too unwieldy. Something adjustable with a smaller default would probably look better. The command cowsay seems to limit it to 44 characters by default

from cowsay.

oganm avatar oganm commented on June 13, 2024

also sorry about a lack of a PR. didn't have time to look into it

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Yeah sorry I didn't explain well. The idea is that the maximum width would be some_max_width or 44. We'd have to shrink the speech bubble to less than 44 if the user's console is smaller than that, though. If their console is smaller, then the speech bubble width would just be the user's console width. Does that make sense?

from cowsay.

sckott avatar sckott commented on June 13, 2024

makes sense @aedobbyn

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Cool cool. If you want to put together a PR @oganm, go for it. Another idea would be to kick it to participants at an upcoming unconf I'm planning on going to since this would be a cool thing for people to talk through implementing. (The idea with this unconf is to let participants contribute to existing packages.) It's your idea, though, so very much up to you!

from cowsay.

oganm avatar oganm commented on June 13, 2024

If I'm not done by that time feel free to hand it to the unconf. Will try to take a look before that

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Works for me, thanks @oganm

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Hey @oganm and @sckott -- planning on using this issue as a jumping-off point at the upcoming unconf I mentioned, if that's okay with you both. Happy to keep you guys in the loop next weekend as people work on it, if you want!

https://github.com/chirunconf/chirunconf19/issues

from cowsay.

sckott avatar sckott commented on June 13, 2024

sounds good @aedobbyn

from cowsay.

oganm avatar oganm commented on June 13, 2024

yep. it's fine 👍

from cowsay.

aedobbyn avatar aedobbyn commented on June 13, 2024

Awesome, thanks guys!

from cowsay.

sckott avatar sckott commented on June 13, 2024

@aedobbyn It would be nice to make this change. Would you want to do it, and have time to?

from cowsay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.