cli icon indicating copy to clipboard operation
cli copied to clipboard

Option --dump-config-json

Open lassik opened this issue 6 years ago • 3 comments

I thought about what would be needed to implement full Unibeautify support in Emacs, and this kind of option would be needed in the cli program:

unibeautify --language c --dump-config-json source-file.c

The process exit status would be as follows:

  • Exit code 0 - settings found and successfully printed to stdout
  • Exit code 1 - no settings found
  • Exit code 2 and bigger - some other error encountered

This would serve two purposes:

  1. To configure the indentation and other settings of Emacs (or another editor) to match the beautifier settings in the .unibeautifyrc file.
  2. To signal that there is in fact a corresponding .unibeautifyrc and hence that Unibeautify should be called automatically on save. (There could be another, faster option only for this purpose that doesn't parse or dump anything, but only uses exit code 0/1/2 as above to tell whether .unibeautifyrc exists.)

The config dump should only have the beautifier options pertinent to the file given, so that the editor plugin will have an easy job translating them to the editor's native options 😄 The source file is not necessarily in the current directory, it could be anywhere (and the pathname can be an absolute or relative).

The config dump could be in any format, but I guess JSON is a natural choice. And matches the existing --config-json option.

lassik avatar Jun 27 '18 18:06 lassik