Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
5peak2me authored Jun 29, 2022
1 parent b24e3e9 commit ac599e6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gradlekotlinconverter.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ if (!args.contains("skipintro")) {
println(intro)
}


var isInClipBoardMode = args.isEmpty()

val input = if (!isInClipBoardMode) args.first() else ""
Expand Down Expand Up @@ -420,15 +421,15 @@ fun String.addParentheses(): String {
// becomes
// id("io.gitlab.arturbosch.detekt") version "1.0.0.RC8"
fun String.addParenthesisToId(): String {

// this will only catch id "..." version ..., should skip id("...")
// should get the id "..."
val idExp = "id\\s*\".*?\"".toRegex()
val idExp = "(id)\\s*\"(.*?)\"".toRegex()

return this.replace(idExp) {
// remove the "id " before the real id
val idValue = it.value.replace("id\\s*".toRegex(), "")
"id($idValue)"
val (id, value) = it.destructured
"""$id("$value")"""
}
}

Expand Down

0 comments on commit ac599e6

Please sign in to comment.