clikt / com.github.ajalt.clikt.output / TermUi / editText


fun editText(text: String, editor: String? = null, env: Map<String, String> = emptyMap(), requireSave: Boolean = false, extension: String = “.txt”): String?

Edit text in the editor.

This blocks until the editor is closed.


text - The text to edit.

editor - The path to the editor to use. Defaults to automatic detection.

env - Environment variables to forward to the editor.

requireSave - If the editor is closed without saving, null will be returned if true, otherwise text will be returned.

extension - The extension of the temporary file that the editor will open. This can affect syntax coloring etc.


CliktError - if the editor cannot be opened.

Return The edited text, or null if requireSave is true and the editor was closed without saving.