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

commonMain.core.Cat.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.*


@DelicateApi
fun cat(init: Cat.() -> Unit = {}) = Cat().apply(init)
/**
 * [gnu coreutils cat](https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html)
 * [linux man](https://man7.org/linux/man-pages/man1/cat.1.html)
 */
@DelicateApi
data class Cat(
  override val opts: MutableList = mutableListOf(),
  override val nonopts: MutableList = mutableListOf(),
) : KommandTypical {
  override val name get() = "cat"
}

@DelicateApi
interface CatOpt : KOptTypical {

  /** Number all output lines, starting with 1. This option is ignored if -b is in effect. */
  data object NumberAll : KOptS("n"), CatOpt

  /** Number all nonempty output lines, starting with 1. */
  data object NumberNonBlank : KOptS("b"), CatOpt

  /** Suppress repeated adjacent blank lines; output just one empty line instead of several. */
  data object SqueezeBlank : KOptS("s"), CatOpt

  /** Display a ‘$’ after the end of each line. The \r\n combination is shown as ‘^M$’. */
  data object ShowLineEnds : KOptS("E"), CatOpt

  /** Display TAB characters as ‘^I’. */
  data object ShowTabs : KOptS("T"), CatOpt

  /**
   * Display control characters except for LFD and TAB using ‘^’ notation
   * and precede characters that have the high bit set with ‘M-’.
   */
  data object ShowNonPrinting : KOptS("v"), CatOpt

  /** Equivalent to -vET. */
  data object ShowAll : KOptS("A"), CatOpt

  /** Equivalent to -vE. */
  data object ShowNonPrintingAndLineEnds : KOptS("e"), CatOpt

  /** Equivalent to -vT. */
  data object ShowNonPrintingAndTabs : KOptS("t"), CatOpt

  data object Help : KOptL("help"), CatOpt

  data object Version : KOptL("--version"), CatOpt

  data object EOOpt : KOptL(""), CatOpt
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy