File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const program = require ( 'commander' )
2- const colour = require ( '../lib/util/colour ' )
2+ const c = require ( 'ansi-colors ' )
33const actions = require ( './actions' )
44
55require ( '../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
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11const program = require ( 'commander' )
2- const colour = require ( './colour ' )
2+ const c = require ( 'ansi-colors ' )
33
44function 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
1515enhanceErrorMessages ( 'missingArgument' , argName => {
16- return `\nMissing required argument ${ colour . yellow ( `<${ argName } >` ) } .`
16+ return `\nMissing required argument ${ c . yellow ( `<${ argName } >` ) } .`
1717} )
1818
1919enhanceErrorMessages ( 'unknownOption' , optionName => {
20- return `\nUnknown option ${ colour . yellow ( optionName ) } .`
20+ return `\nUnknown option ${ c . yellow ( optionName ) } .`
2121} )
2222
2323enhanceErrorMessages ( '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
Original file line number Diff line number Diff line change 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 },
You can’t perform that action at this time.
0 commit comments