What is yosay?
The yosay npm package is a fun utility that allows you to display messages in a speech bubble format, similar to the classic 'cowsay' but with a character resembling Yeoman. It's often used to add a bit of humor or personality to command-line interfaces.
What are yosay's main functionalities?
Basic Message Display
This feature allows you to display a basic message in a speech bubble format. The code sample shows how to require the yosay package and use it to print 'Hello, world!' in a speech bubble.
const yosay = require('yosay');
console.log(yosay('Hello, world!'));
Multiline Message Display
This feature allows you to display multiline messages. The code sample demonstrates how to print a message that spans multiple lines in a speech bubble.
const yosay = require('yosay');
console.log(yosay('Hello, world!
This is a multiline message.'));
Customizing the Character
This feature allows you to customize the speech bubble, such as setting a maximum length for the message. The code sample shows how to limit the message length to 20 characters.
const yosay = require('yosay');
console.log(yosay('Hello, world!', { maxLength: 20 }));
Other packages similar to yosay
cowsay
The cowsay package is a popular alternative that displays messages in a speech bubble with an ASCII art cow. It offers various customization options, including different characters and speech bubble styles. Compared to yosay, cowsay has a wider range of characters and is more widely known.
figlet
The figlet package allows you to create text banners in various ASCII art fonts. While it doesn't provide speech bubbles, it is often used to add stylized text to command-line interfaces. Figlet focuses more on text art rather than character-based speech bubbles like yosay.
cli-boxes
The cli-boxes package provides box-drawing characters for creating boxes in the terminal. It doesn't offer speech bubbles or characters, but it can be used to create custom box designs around text. This package is more about creating structured layouts rather than adding personality to messages.
yosay
Tell Yeoman what to say
Like cowsay, but less cow.
Install
$ npm install --save yosay
Usage
var yosay = require('yosay');
console.log(yosay('Hello, and welcome to my fantastic generator full of whimsy and bubble gum!'));
You can style your text with chalk before passing it to yosay
.
CLI
$ npm install --global yosay
$ yosay --help
Usage
yosay <string>
yosay <string> --maxLength 8
echo <string> | yosay
Example
yosay 'Sindre is a horse'
_-----_
| | .--------------------------.
|--(o)--| | Sindre is a horse |
`---------´ '--------------------------'
( _´U`_ )
/___A___\
| ~ |
__'.___.'__
´ ` |° ´ Y `
License
BSD license
Copyright (c) Google