Skip to content

Commit

Permalink
Colorize the help message (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
msabramo committed Mar 18, 2023
1 parent 54cef67 commit a0dce6e
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,31 @@ const printAllStyles = () => {
};

const cli = meow(`
Usage
$ chalk <style> … <string>
$ echo <string> | chalk --stdin <style> …
${chalk.greenBright.inverse(' Usage ')}
Options
--template, -t Style template. The \`~\` character negates the style.
--stdin Read input from stdin rather than from arguments.
--no-newline, -n Don't emit a newline (\`\\n\`) after the input.
--demo Demo of all Chalk styles.
$ ${chalk.green('chalk')} ${chalk.yellow('[options…]')} ${chalk.cyan('<style> … <string>')}
$ ${chalk.green('echo')} ${chalk.cyan('<string>')} | ${chalk.green('chalk')} ${chalk.yellow('--stdin [options…]')} ${chalk.cyan('<style> …')}
${chalk.yellowBright.inverse(' Options ')}
${chalk.yellow('--template, -t')} Style template. The \`~\` character negates the style.
${chalk.yellow('--stdin')} Read input from stdin rather than from arguments.
${chalk.yellow('--no-newline, -n')} Don't emit a newline (\`\\n\`) after the input.
${chalk.yellow('--demo')} Demo of all Chalk styles.
${chalk.redBright.inverse(' Examples ')}
Examples
$ chalk red bold 'Unicorns & Rainbows'
${chalk.red.bold('Unicorns & Rainbows')}
$ chalk -t '{red.bold Unicorns & Rainbows}'
${chalk.red.bold('Unicorns & Rainbows')}
$ chalk -t '{red.bold Dungeons and Dragons {~bold.blue (with added fairies)}}'
${chalk`{red.bold Dungeons and Dragons {~bold.blue (with added fairies)}}`}
$ echo 'Unicorns from stdin' | chalk --stdin red bold
${chalk.red.bold('Unicorns from stdin')}
`, {
importMeta: import.meta,
allowUnknownFlags: false,
Expand Down

0 comments on commit a0dce6e

Please sign in to comment.