From 738847c1564667b969bf613c7e2669461182baea Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Fri, 2 Jun 2017 17:48:52 -0300 Subject: [PATCH] Switch clang-format to using Executables, update docs --- docs/options.md | 34 +++++++++++++++++++++++++++++ src/beautifiers/clang-format.coffee | 18 ++++++++++----- src/options.json | 32 +++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 5 deletions(-) diff --git a/docs/options.md b/docs/options.md index 305829d..960b0bc 100644 --- a/docs/options.md +++ b/docs/options.md @@ -164,6 +164,40 @@ Options for autopep8 executable. 2. Go into *Packages* and search for "*Atom Beautify*" package. 3. Find the option "*autopep8*" and change it to your desired configuration. +##### [beautysh](#beautysh) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `object` + +**Description**: + +Options for beautysh executable. + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*beautysh*" and change it to your desired configuration. + +##### [ClangFormat](#clangformat) + +**Important**: This option is only configurable from within Atom Beautify's setting panel. + +**Type**: `object` + +**Description**: + +Options for ClangFormat executable. + +**How to Configure** + +1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to +*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*. +2. Go into *Packages* and search for "*Atom Beautify*" package. +3. Find the option "*ClangFormat*" and change it to your desired configuration. + ##### [Emacs](#emacs) **Important**: This option is only configurable from within Atom Beautify's setting panel. diff --git a/src/beautifiers/clang-format.coffee b/src/beautifiers/clang-format.coffee index eb4fa32..30f4e31 100644 --- a/src/beautifiers/clang-format.coffee +++ b/src/beautifiers/clang-format.coffee @@ -11,7 +11,17 @@ module.exports = class ClangFormat extends Beautifier name: "clang-format" link: "https://clang.llvm.org/docs/ClangFormat.html" - isPreInstalled: false + executables: [ + { + name: "ClangFormat" + cmd: "clang-format" + homepage: "https://clang.llvm.org/docs/ClangFormat.html" + installation: "https://clang.llvm.org/docs/ClangFormat.html" + version: { + parse: (text) -> text.match(/version (\d+\.\d+\.\d+)/)[1] + } + } + ] options: { "C++": false @@ -64,12 +74,10 @@ module.exports = class ClangFormat extends Beautifier ) .then((dumpFile) => # console.log("clang-format", dumpFile) - return @run("clang-format", [ + return @exe("clang-format").run([ @dumpToFile(dumpFile, text) ["--style=file"] - ], help: { - link: "https://clang.llvm.org/docs/ClangFormat.html" - }).finally( -> + ]).finally( -> fs.unlink(dumpFile) ) ) diff --git a/src/options.json b/src/options.json index d3c8fc5..22061f8 100644 --- a/src/options.json +++ b/src/options.json @@ -9178,6 +9178,22 @@ } } }, + "clang-format": { + "key": "clang-format", + "title": "ClangFormat", + "type": "object", + "collapsed": true, + "description": "Options for ClangFormat executable.", + "properties": { + "path": { + "key": "path", + "title": "Executable Path", + "type": "string", + "default": "", + "description": "Absolute path to the \"clang-format\" executable." + } + } + }, "emacs": { "key": "emacs", "title": "Emacs", @@ -9257,6 +9273,22 @@ "description": "Absolute path to the \"Rscript\" executable." } } + }, + "beautysh": { + "key": "beautysh", + "title": "beautysh", + "type": "object", + "collapsed": true, + "description": "Options for beautysh executable.", + "properties": { + "path": { + "key": "path", + "title": "Executable Path", + "type": "string", + "default": "", + "description": "Absolute path to the \"beautysh\" executable." + } + } } } }