🆕 Add indent_size capability for beautysh
This commit is contained in:
parent
b5790461cd
commit
306dd569b4
|
@ -57,7 +57,7 @@ See [all supported options in the documentation at `docs/options.md`](https://g
|
|||
| --- | --- | --- | ---- |
|
||||
| Apex | `Apex` |`.cls`, `.trigger` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
|
||||
| Arduino | `Arduino` |`.ino`, `.pde` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default) |
|
||||
| Bash | `Shell script` |`.bash`, `.sh` | [`beautysh`](https://github.com/bemeurer/beautysh) (Default) |
|
||||
| Bash | `Shell Script` |`.bash`, `.sh` | [`beautysh`](https://github.com/bemeurer/beautysh) (Default) |
|
||||
| C | `C`, `opencl` |`.h`, `.c`, `.cl` | [`Uncrustify`](https://github.com/uncrustify/uncrustify) (Default), [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) |
|
||||
| Coldfusion | `html` |`.cfm`, `.cfml`, `.cfc` | [`Pretty Diff`](https://github.com/prettydiff/prettydiff) (Default) |
|
||||
| Clojure | `Clojure` |`.clj`, `.cljs`, `.edn` | [`cljfmt`](https://github.com/snoe/node-cljfmt) (Default) |
|
||||
|
|
|
@ -63,7 +63,9 @@
|
|||
</dt>
|
||||
<dd>
|
||||
<pre><code class='coffeescript'>{
|
||||
Bash: true
|
||||
Bash: {
|
||||
indent_size: true
|
||||
}
|
||||
}</code></pre>
|
||||
|
||||
</dd>
|
||||
|
|
|
@ -119,7 +119,7 @@ Thank you.</p><h2 id="language-support">Language Support</h2><p>See <a href="htt
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Bash</td>
|
||||
<td><code>Shell script</code></td>
|
||||
<td><code>Shell Script</code></td>
|
||||
<td><code>.bash</code>, <code>.sh</code></td>
|
||||
<td><a href="https://github.com/bemeurer/beautysh"><code>beautysh</code></a> (Default)</td>
|
||||
</tr>
|
||||
|
|
|
@ -39,6 +39,22 @@
|
|||
</table>
|
||||
<h2>Variables Summary</h2>
|
||||
<dl class='constants'>
|
||||
<dt id='scope-variable'>
|
||||
scope
|
||||
=
|
||||
</dt>
|
||||
<dd>
|
||||
<pre><code class='coffeescript'>['source.sh', 'source.bash']</code></pre>
|
||||
|
||||
</dd>
|
||||
<dt id='defaultIndentSize-variable'>
|
||||
defaultIndentSize
|
||||
=
|
||||
</dt>
|
||||
<dd>
|
||||
<pre><code class='coffeescript'>(softTabs ? tabLength : 1)</code></pre>
|
||||
|
||||
</dd>
|
||||
<dt id='module.exports-variable'>
|
||||
module.exports
|
||||
=
|
||||
|
@ -57,7 +73,15 @@
|
|||
/*
|
||||
Supported extensions
|
||||
*/
|
||||
extensions: ["bash", "sh"]
|
||||
extensions: ["bash", "sh"],
|
||||
options: {
|
||||
indent_size: {
|
||||
type: 'integer',
|
||||
"default": defaultIndentSize,
|
||||
minimum: 0,
|
||||
description: "Indentation size/length"
|
||||
}
|
||||
}
|
||||
}</code></pre>
|
||||
|
||||
</dd>
|
||||
|
|
|
@ -328,7 +328,6 @@ Path to uncrustify config file. i.e. uncrustify.cfg (Supported by Uncrustify)
|
|||
| `disabled` | :white_check_mark: |
|
||||
| `default_beautifier` | :white_check_mark: |
|
||||
| `beautify_on_save` | :white_check_mark: |
|
||||
| `configPath` | :white_check_mark: |
|
||||
|
||||
**Description**:
|
||||
|
||||
|
@ -389,30 +388,6 @@ Automatically beautify Bash files on save
|
|||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*Beautify On Save*" and change it to your desired configuration.
|
||||
|
||||
##### [Config Path](#config-path)
|
||||
|
||||
**Namespace**: `bash`
|
||||
|
||||
**Key**: `configPath`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`beautysh`](#beautysh)
|
||||
|
||||
**Description**:
|
||||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by beautysh)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"bash": {
|
||||
"configPath": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### [C](#c)
|
||||
|
||||
**Supported Beautifiers**: [`Uncrustify`](#uncrustify) [`clang-format`](#clang-format)
|
||||
|
@ -16971,33 +16946,6 @@ sort imports (requires isort installed) (Supported by autopep8)
|
|||
```
|
||||
|
||||
|
||||
### beautysh
|
||||
|
||||
##### [Config Path](#config-path)
|
||||
|
||||
**Namespace**: `bash`
|
||||
|
||||
**Key**: `configPath`
|
||||
|
||||
**Type**: `string`
|
||||
|
||||
**Supported Beautifiers**: [`beautysh`](#beautysh)
|
||||
|
||||
**Description**:
|
||||
|
||||
Path to uncrustify config file. i.e. uncrustify.cfg (Supported by beautysh)
|
||||
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
```json
|
||||
{
|
||||
"bash": {
|
||||
"configPath": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### coffee-fmt
|
||||
|
||||
##### [Indent size](#indent-size)
|
||||
|
|
|
@ -5,10 +5,11 @@ module.exports = class BashBeautify extends Beautifier
|
|||
name: "beautysh"
|
||||
link: "https://github.com/bemeurer/beautysh"
|
||||
options: {
|
||||
Bash: true
|
||||
Bash:
|
||||
indent_size: true
|
||||
}
|
||||
|
||||
beautify: (text, language, options) ->
|
||||
file = @tempFile("input", text)
|
||||
@run('beautysh', [ file ], help: { link: "https://github.com/bemeurer/beautysh" })
|
||||
@run('beautysh', [ '-i', options.indent_size, '-f', file ], help: { link: "https://github.com/bemeurer/beautysh" })
|
||||
.then(=> @readFile file)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
scope = ['source.sh', 'source.bash']
|
||||
tabLength = atom?.config.get('editor.tabLength', scope: scope) ? 2
|
||||
softTabs = atom?.config.get('editor.softTabs', scope: scope) ? true
|
||||
defaultIndentSize = (if softTabs then tabLength else 1)
|
||||
|
||||
module.exports = {
|
||||
|
||||
name: "Bash"
|
||||
|
@ -20,4 +25,11 @@ module.exports = {
|
|||
"sh"
|
||||
]
|
||||
|
||||
options:
|
||||
indent_size:
|
||||
type: 'integer'
|
||||
default: defaultIndentSize
|
||||
minimum: 0
|
||||
description: "Indentation size/length"
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue