Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorize the help message #42

Merged
merged 2 commits into from
Mar 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,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,
// TODO: Disabled until https://github.com/sindresorhus/meow/issues/197 is fixed.
Expand Down