commonMain.XClip.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kommandline Show documentation
Show all versions of kommandline Show documentation
Kotlin DSL for popular CLI commands.
The newest version!
package pl.mareklangiewicz.kommand
import pl.mareklangiewicz.annotations.DelicateApi
// TODO_later: real implementation (class/types/all options)
enum class XClipSelection { Primary, Secondary, Clipboard }
@OptIn(DelicateApi::class)
fun xclipOut(selection: XClipSelection = XClipSelection.Primary) =
kommand("xclip", "-o", "-selection", selection.name.lowercase())
.reducedOutToList()
@OptIn(DelicateApi::class)
fun xclipIn(selection: XClipSelection = XClipSelection.Primary, vararg inFiles: String) =
kommand("xclip", "-i", "-selection", selection.name.lowercase(), *inFiles)
.reducedOutToList()