Skip to content

Commit

Permalink
Add ability to specify editorconfig path
Browse files Browse the repository at this point in the history
  • Loading branch information
charbgr committed May 5, 2018
1 parent 3c31348 commit e593dcf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ktlint/src/main/kotlin/com/github/shyiko/ktlint/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ object Main {
@Option(names = arrayOf("-y"), hidden = true)
private var forceApply: Boolean = false

@Option(names = arrayOf("--editorconfig-path"), description = arrayOf("Specify folder path of .editorconfig"))
private var editorConfigDirParam: String? = null
private val editorConfigDir: String
get() {
val filePath = if (editorConfigDirParam == null) File(".") else File(editorConfigDirParam)
return filePath.canonicalPath
}

@Parameters(hidden = true)
private var patterns = ArrayList<String>()

Expand Down Expand Up @@ -262,7 +270,7 @@ object Main {
val reporter = loadReporter(dependencyResolver)
// load .editorconfig
val userData = (
EditorConfig.of(workDir)
EditorConfig.of(editorConfigDir)
?.also { editorConfig ->
if (debug) {
System.err.println("[DEBUG] Discovered .editorconfig (${
Expand Down

0 comments on commit e593dcf

Please sign in to comment.