gulp-cli
gulp-cli copied to clipboard
Allow customizing CLI colors through .gulprc file
I've added customizing mechanism in gulp-cli. And also I've made colors of a task tree customizable with this.
sttk/gulp-cli#make_customizable
- You can change the colors by
.gulprc
files in user home directory or project working directory. - You can also change the colors with a file specified by
--customize
option. - You can see a list of customizable settings by
--customize
option which has no value.
@sttk The first thing that I'd like to address is the .gulprc
file. I am all for having it, but I think we need it implemented over in Liftoff (which has been discussed before) - Check out the issue at https://github.com/js-cli/js-liftoff/issues/8 and maybe you'd be interested in implementing the rc lookup over there before submitting this PR to gulp-cli.
@phated OK. I'll see the issue and Liftoff. And I'll try it if I can.
Changed the title here. Also split the .gulprc file to issue https://github.com/gulpjs/gulp-cli/issues/69
Random ideas for theming (so they are documented somewhere):
// regexp? HIGHLIGHT: (.*)
log.withTheme()
log('Write some text and {HIGHLIGHT: The Thing}', theme)
log('{ERROR: Failed to load external module} {HLIGHT: {NAME}}', {NAME: name})
log('{ERROR}Failed to load external module{/ERROR} {HIGHLIGHT}' + name + '{/HIGHLIGHT}')
log.info('Using gulpfile {HIGHLIGHT: %s}', tildify(env.configPath));
@phated I've created a package theming-log to manage text decoration of logging with themes on the trial basis.
This package is still a prototype and would be needed to add some functions (for example, printf-style variables).
Can you have a look whether it fits your idea?
@sttk I didn't review the whole project, but I like what I see in the documentation. It touches on a lot of the ideas I had but I'd want to see how it is used for this project.
When I was working on ideas, I was trying to avoid a factory function because we don't have themes loaded from the config files before we start logging (e.g. gulp --help
, etc)
@phated Thank you for having a look, and I'm glad you like it.
About the way to using theming-log for this package, most of logs in gulp-cli/index.js
, including the help message, would be ok in the normal way because they are outputted after loading the config files, but for adding themes to the help message it may be needed to overide some methods of yargs.
Since logs for require
and requireFail
events are called before loading the config files, they would be needed to think out.
About logs in other modules, I think it is possible by overriding methods of gulplog (or a similar new logger which is a singleton) with log functions created by theming-log.
Yeah, I was running into color issues on --help
and require
/requireFail
since we don't configure the theme until after.
I thought maybe the config loading would have to be merged into the CLI code but that doesn't work if Liftoff is being used to find the cwd and stuff.
We might as well land this in the next major as well. Moving to the 3.0 milestone.
I'll address this after fixing the issues of flags.cwd
(# 109) and initial cwd (# 146 and # 154).