fun precommitHook()

in bunch-cli/src/main/kotlin/org/jetbrains/bunches/hooks/BunchPreCommitHook.kt [25:43]


fun precommitHook(args: Array<String>) {
    val forgottenFiles = precommitLostFiles(args)
    if (forgottenFiles.isEmpty()) {
        exit(0)
    }

    println(
        """
        |Some bunch files were not included in commit:
        |${forgottenFiles.joinToString("\n|")}
        |Do you want to continue? (Y/N)
    """.trimMargin()
    )
    when (readLine()) {
        "Y", "y", "Yes", "yes", "" -> exit(0)
        "N", "n", "No", "no" -> exit(1)
        else -> exit(1)
    }
}