yeoman / yosay

Tell Yeoman what to say
BSD 2-Clause "Simplified" License
205 stars 43 forks source link

Doesn't handle linebreaks #9

Closed sindresorhus closed 9 years ago

sindresorhus commented 10 years ago
❯ yosay 'ssf
asd'
     _-----_
    |       |    .--------------------------.
    |--(o)--|    |            ssf           |
   `---------´   '--------------------------'|                          |
    ( _´U`_ )    |            asd           |
    /___A___\    '--------------------------'
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 
stephenplusplus commented 10 years ago

Hmm, that looks perfect to me...

Jay-kay. I'll play with it later today :+1:

wayou commented 9 years ago

can we use \n as line break?

mischah commented 9 years ago

Any progress on this?

I just ran into that issue:

end: function () {
    this.log(yosay(
        chalk.red('That’s it!') + ' You’re all set to begin working with Bootstrap ✌(-‿-)✌\n' +
        'Enter `grunt tasks` to see the available Grunt tasks.'
    ));
}

Which renders to:

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |   That’s it! You’re all  |
   `---------´   |   set to begin working   |
    ( _´U`_ )    |  with Bootstrap ✌(-‿-)✌  |
    /___A___\    '--------------------------'|                          |
     |  ~  |     |  Enter `grunt tasks` to  |
   __'.___.'__   |  see the available Grunt |
 ´   `  |° ´ Y ` |          tasks.          |
                 '--------------------------'

I would love to use a line break within the end() method of my Yeoman generator :kissing_heart:

stephenplusplus commented 9 years ago

This basically came down to... I couldn't solve the problem. I would be grateful if someone else could take a look.

agarrharr commented 9 years ago

The issue was that a new line went into the array as an empty string. The if statement thought it was at the end of the array because an empty string is falsy. So I explicitly check for undefined instead.