Improve handling options in Python beautifier.

See #35.
This commit is contained in:
Glavin Wiechert 2014-12-28 02:22:44 -04:00
parent b7a34b6178
commit 974897b6f8
1 changed files with 8 additions and 2 deletions

View File

@ -5,13 +5,19 @@ getCmd = (inputPath, outputPath, options) ->
path = options.autopep8_path # jshint ignore: line
# jshint ignore: line
# jshint ignore: line
optionsStr = "--max-line-length " + options.max_line_length + " --indent-size " + options.indent_size + " --ignore " + options.ignore.join(",") # jshint ignore: line
optionsStr = ""
if options.max_line_length?
optionsStr += "--max-line-length #{options.max_line_length}"
if options.indent_size?
optionsStr += " --indent-size #{options.indent_size}"
if options.ignore?
optionsStr += " --ignore " + options.ignore.join(",") # jshint ignore: line
if path
# Use absolute path
"#{path} \"#{inputPath}\" #{optionsStr}"
else
# Use command available in $PATH
"autopep8 \"" + inputPath + "\" " + optionsStr
"autopep8 \"#{inputPath}\" #{optionsStr}"
"use strict"
cliBeautify = require("./cli-beautify")
isStdout = true