Skip to content

Commit

Permalink
Improve SQL Beautifier to support missing config options.
Browse files Browse the repository at this point in the history
Fixes #67.
  • Loading branch information
Glavin001 committed Dec 28, 2014
1 parent 77f58bb commit b7a34b6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/langs/sql-beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ Requires https://github.com/andialbrecht/sqlparse
###
getCmd = (inputPath, outputPath, options) ->
path = options.sqlformat_path
optionsStr = " --indent_width={0} --keywords={1} --identifiers={2} --reindent"
optionsStr = optionsStr.replace("{0}", options.indent_size)
.replace("{1}", options.keywords)
.replace("{2}", options.identifiers)

optionsStr = "--reindent"
if options.indent_size?
optionsStr += " --indent_width=#{options.indent_size}"
if options.keywords?
optionsStr += " --keywords=#{options.keywords}"
if options.identifiers
optionsStr += " --identifiers=#{options.identifiers}"

if path
# Use absolute path
"python \"" + path + "\" \"" + inputPath + "\" " + optionsStr
Expand Down

0 comments on commit b7a34b6

Please sign in to comment.