-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add --demo
flag
#10
Conversation
cli.js
Outdated
|
||
Examples | ||
$ chalk --demo |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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 = [ |
There was a problem hiding this comment.
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']; |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indentation still
1948da3
to
22981d4
Compare
Sorry for the indentation problems, mix of tab and space i didn't noticed. |
Thanks :) |
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