All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.core.Touch.kt Maven / Gradle / Ivy

There is a newer version: 0.0.87
Show newest version
package pl.mareklangiewicz.kommand.core

import pl.mareklangiewicz.annotations.DelicateApi
import pl.mareklangiewicz.kommand.*

/** Update the access and modification times of each file to the current time. Create empty files if necessary. */
@OptIn(DelicateApi::class)
fun touch(vararg files: String) = touch { nonopts.addAll(files) }.reducedOutToUnit()

@DelicateApi
fun touch(init: Touch.() -> Unit) = Touch().apply(init)

/** [linux man](https://man7.org/linux/man-pages/man1/touch.1.html) */
@DelicateApi
data class Touch(
  override val opts: MutableList = mutableListOf(),
  override val nonopts: MutableList = mutableListOf(),
) : KommandTypical {
  override val name get() = "touch"
}



@DelicateApi
interface TouchOpt : KOptTypical {
  data object TimeOfAccessOnly : TouchOpt, KOptS("a")
  data object TimeOfChangeOnly : TouchOpt, KOptS("m")
  data object DisableCreation : TouchOpt, KOptS("c")
  data class Date(val date: String) : TouchOpt, KOptLN(date)
  data object Help : TouchOpt, KOptLN()
  data object Version : TouchOpt, KOptLN()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy