gulp-cli icon indicating copy to clipboard operation
gulp-cli copied to clipboard

Allow customizing CLI colors through .gulprc file

Open sttk opened this issue 8 years ago • 10 comments

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 avatar Feb 28 '16 03:02 sttk

@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 avatar Mar 03 '16 00:03 phated

@phated OK. I'll see the issue and Liftoff. And I'll try it if I can.

sttk avatar Mar 04 '16 12:03 sttk

Changed the title here. Also split the .gulprc file to issue https://github.com/gulpjs/gulp-cli/issues/69

phated avatar Apr 05 '16 02:04 phated

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 avatar Dec 21 '17 22:12 phated

@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 avatar Jan 08 '18 02:01 sttk

@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 avatar Jan 08 '18 22:01 phated

@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.

sttk avatar Jan 09 '18 15:01 sttk

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.

phated avatar Jan 09 '18 17:01 phated

We might as well land this in the next major as well. Moving to the 3.0 milestone.

phated avatar Apr 20 '19 17:04 phated

I'll address this after fixing the issues of flags.cwd (# 109) and initial cwd (# 146 and # 154).

sttk avatar Apr 21 '19 00:04 sttk