Added the option to indent Bash scripts with tabs

This commit is contained in:
Lawstorant 2017-11-24 21:25:59 +01:00
parent 0ba7fc5817
commit 223880d4a4
4 changed files with 27 additions and 3 deletions

View File

@ -1,5 +1,5 @@
# Next
- ...
- Add the option to indent Bash with tabs [#1951](https://github.com/Glavin001/atom-beautify/issues/1951)
# v0.30.9 (2017-11-22)
- Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed.

View File

@ -24,10 +24,16 @@ module.exports = class BashBeautify extends Beautifier
options: {
Bash:
indent_size: true
use_tabs: true
}
beautify: (text, language, options) ->
beautysh = @exe("beautysh")
file = @tempFile("input", text)
tabs = options.use_tabs
if tabs is true
beautysh.run([ '-t', '-f', file ])
.then(=> @readFile file)
else
beautysh.run([ '-i', options.indent_size, '-f', file ])
.then(=> @readFile file)

View File

@ -27,5 +27,9 @@ module.exports = {
default: null
minimum: 0
description: "Indentation size/length"
use_tabs:
type: 'boolean'
default: null
description: "Use tabs for indentation"
}

View File

@ -145,6 +145,20 @@
"name": "Bash",
"namespace": "bash"
}
},
"use_tabs": {
"type": "boolean",
"default": null,
"description": "Use tabs instead of spaces for indentation, overrides `Indent Size` (Supported by beautysh)",
"title": "Indent with tabs",
"beautifiers": [
"beautysh"
],
"key": "use_tabs",
"language": {
"name": "Bash",
"namespace": "bash"
}
},
"disabled": {
"title": "Disable Beautifying Language",