constyble icon indicating copy to clipboard operation
constyble copied to clipboard

Add command to initialize a new config

Open bartveneman opened this issue 5 years ago • 3 comments

Be able to let Constyle generate a new .constyblerc file based on CSS that is provided. This should make getting started a lot easier.

constyble init style.css
# or
cat style.css | constyble init

Should generate a .constyblerc file in the current working directory based on the css statistics of the passed CSS.

# Generating a custom file path config
constyble init style.css --config='/path/to/constyle.json'
# or
cat style.css | constyble init --config='/path/to/constyle.json'

To be discussed

  • What to do when file cannot be written?
  • What to when file already exists?
  • Should we implement constyble init --help, displaying an init oriented help message?

Idea credit: @jeroen-severein

bartveneman avatar Apr 27 '19 09:04 bartveneman

@jeroen-severein Could you chime in and give some thoughts on the above?

bartveneman avatar Jun 02 '19 15:06 bartveneman

In case it can’t be written I would expect it to exit with a “can’t write to output file”-error.

If it already exists, I would expect a “overwrite yes or no?” prompt.

What would the init specific help need to explain further? I feel it would be enough if the init option is explained in the general constyble --help option. It would be nice to have explanations in comments of the settings file it generates though.

jeroen-severein avatar Jun 02 '19 16:06 jeroen-severein

It could be useful to replace Meow with Sade, to gain support for subcommands (meow lacks them): https://www.npmjs.com/package/sade

bartveneman avatar Jul 30 '19 21:07 bartveneman