Skip to content

Commit fdaafbc

Browse files
committed
fix: Use ansi-colors not ansi-color. Doh
1 parent f9852c2 commit fdaafbc

4 files changed

Lines changed: 10 additions & 21 deletions

File tree

lib/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const program = require('commander')
2-
const colour = require('../lib/util/colour')
2+
const c = require('ansi-colors')
33
const actions = require('./actions')
44

55
require('../lib/util/enhanceErrorMessages')
@@ -21,13 +21,13 @@ function tymlyCli (argv) {
2121
.arguments('<command>')
2222
.action((cmd) => {
2323
program.outputHelp()
24-
console.log(`${colour.red('Unknown command')} ${colour.yellow(cmd)}.`)
24+
console.log(`${c.red('Unknown command')} ${c.yellow(cmd)}.`)
2525
console.log()
2626
})
2727

2828
program.on('--help', () => {
2929
console.log()
30-
console.log(`Run ${colour.cyan(`tymly <command> --help`)} for detailed usage of given command.`)
30+
console.log(`Run ${c.cyan(`tymly <command> --help`)} for detailed usage of given command.`)
3131
console.log()
3232
})
3333

lib/util/colour.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/util/enhanceErrorMessages.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
const program = require('commander')
2-
const colour = require('./colour')
2+
const c = require('ansi-colors')
33

44
function enhanceErrorMessages (methodName, log) {
55
program.Command.prototype[methodName] = function (...args) {
66
if (methodName === 'unknownOption' && this._allowUnknownOption) {
77
return
88
}
99
this.outputHelp()
10-
console.log(colour.red(log(...args)))
10+
console.log(c.red(log(...args)))
1111
console.log()
1212
}
1313
}
1414

1515
enhanceErrorMessages('missingArgument', argName => {
16-
return `\nMissing required argument ${colour.yellow(`<${argName}>`)}.`
16+
return `\nMissing required argument ${c.yellow(`<${argName}>`)}.`
1717
})
1818

1919
enhanceErrorMessages('unknownOption', optionName => {
20-
return `\nUnknown option ${colour.yellow(optionName)}.`
20+
return `\nUnknown option ${c.yellow(optionName)}.`
2121
})
2222

2323
enhanceErrorMessages('optionMissingArgument', (option, flag) => {
24-
return `Missing required argument for option ${colour.yellow(option.flags)}` + (
25-
flag ? `, got ${colour.yellow(flag)}` : ``
24+
return `Missing required argument for option ${c.yellow(option.flags)}` + (
25+
flag ? `, got ${c.yellow(flag)}` : ``
2626
)
2727
})
2828

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"dependencies": {
2626
"@wmfs/tymly-scaffold": "1.0.0",
27-
"ansi-color": "0.2.1",
27+
"ansi-colors": "3.2.3",
2828
"commander": "2.19.0",
2929
"enquirer": "2.3.0"
3030
},

0 commit comments

Comments
 (0)