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

Add --demo flag #10

Merged
merged 4 commits into from
Nov 1, 2018
Merged

Add --demo flag #10

merged 4 commits into from
Nov 1, 2018

Conversation

wcastand
Copy link
Contributor

@wcastand wcastand commented Oct 7, 2018

Do we need a test for it ? i started doing it but feels dumb so i didn't keep it lol

Tell me if anything is not ok :)

Fixes chalk/chalk#210

cli.js Outdated

Examples
$ chalk --demo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation.

cli.js Outdated
@@ -12,9 +12,11 @@ const cli = meow(`
$ echo <string> | chalk <style> …

Options
--template, -t Style template. The \`~\` character negates the style.
--template, -t Style template. The \`~\` character negates the style.
--demo, -d Demo of chalk possibilities.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a better description. And no point in having a short flag for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help output needs to be updated in the readme too.

Copy link
Contributor Author

@wcastand wcastand Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you want as a description then, would be easier than trying to figure it out :)
I'll push the corrections once we decide the right description.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Demo of all Chalk styles

cli.js Outdated
chalk.bgBlue('bgBlue'),
chalk.bgMagenta('bgMagenta'),
chalk.bgCyan('bgCyan'),
chalk.bgWhite('bgWhite')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simplified by putting the names in an array, looping over it and calling the chalk method by that name.

cli.js Outdated
@@ -42,7 +48,34 @@ function init(data) {
}

if (process.stdin.isTTY || cli.flags.stdin === false) {
if (cli.flags.template) {
if (cli.flags.demo) {
const demoStr = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

demoStr => demoString

cli.js Outdated
@@ -42,7 +48,34 @@ function init(data) {
}

if (process.stdin.isTTY || cli.flags.stdin === false) {
if (cli.flags.template) {
if (cli.flags.demo) {
const demoStr = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole demo thing should be moved to a top-level function and just called here.

cli.js Outdated
@@ -6,15 +6,22 @@ const dotProp = require('dot-prop');
const getStdin = require('get-stdin');
const meow = require('meow');

function demoFunction() {
const demoString = ['bold', 'dim', 'italic', 'underline', 'inverse', 'strikethrough', 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'gray', 'bgBlack', 'bgRed', 'bgGreen', 'bgYellow', 'bgBlue', 'bgMagenta', 'bgCyan', 'bgWhite'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put each item on a separate line.

cli.js Outdated
const cli = meow(`
Usage
$ chalk <style> … <string>
$ echo <string> | chalk <style> …

Options
--template, -t Style template. The \`~\` character negates the style.
--template, -t Style template. The \`~\` character negates the style.
--demo Demo of all Chalk styles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The descriptions should be vertically aligned.

cli.js Outdated

Examples
$ chalk --demo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need an example of this.

readme.md Outdated
@@ -23,6 +23,7 @@ $ chalk --help

Options
--template, -t Style template. The `~` character negates the style.
--demo Demo of all Chalk styles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation still

@wcastand
Copy link
Contributor Author

Sorry for the indentation problems, mix of tab and space i didn't noticed.

@sindresorhus sindresorhus changed the title add option demo Add --demo flag Nov 1, 2018
@sindresorhus sindresorhus merged commit ce0d158 into chalk:master Nov 1, 2018
@sindresorhus
Copy link
Member

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants