Readd incomplete changes, now without missing apply method
This commit is contained in:
parent
0d797ea684
commit
517720c720
|
@ -126,23 +126,30 @@ case class Pause(millisec: Long) extends Slide
|
||||||
case object PauseKey extends Slide
|
case object PauseKey extends Slide
|
||||||
case class Meta(contents: (Presentation, Int) => Slide) extends Slide
|
case class Meta(contents: (Presentation, Int) => Slide) extends Slide
|
||||||
|
|
||||||
case class TypedCommand[T](exec: T => String, display: String, cmd: T) extends Slide:
|
case class TypedCommand[T](exec: T => String, display: String, cmd: T, cmdIsHidden: Boolean, outputIsHidden: Boolean) extends Slide:
|
||||||
private lazy val _output = exec(cmd)
|
private lazy val _output = exec(cmd)
|
||||||
def output = _output
|
def output = _output
|
||||||
|
|
||||||
infix def showing (s: String): TypedCommand[T] = TypedCommand(exec, s, cmd)
|
infix def showing (s: String): TypedCommand[T] = TypedCommand(exec, s, cmd)
|
||||||
|
|
||||||
def show() =
|
def show() =
|
||||||
prompt()
|
force()
|
||||||
Terminal.showCursor()
|
if ! cmdIsHidden then
|
||||||
typeCmd()
|
prompt()
|
||||||
print(output)
|
Terminal.showCursor()
|
||||||
Terminal.hideCursor()
|
typeCmd()
|
||||||
|
if ! outputIsHidden then
|
||||||
|
print(output)
|
||||||
|
if ! cmdIsHidden then
|
||||||
|
Terminal.hideCursor()
|
||||||
|
|
||||||
def quickShow() =
|
def quickShow() =
|
||||||
prompt()
|
force()
|
||||||
println(display)
|
if ! cmdIsHidden then
|
||||||
print(output)
|
prompt()
|
||||||
|
println(display)
|
||||||
|
if ! outputIsHidden then
|
||||||
|
print(output)
|
||||||
|
|
||||||
def prompt() = print(fansi.Color.LightGreen("user@host % "))
|
def prompt() = print(fansi.Color.LightGreen("user@host % "))
|
||||||
def force() = _output
|
def force() = _output
|
||||||
|
@ -180,6 +187,10 @@ object TypedCommand:
|
||||||
def apply(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
def apply(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||||
TypedCommand(run, cmd.mkString(" "), cmd.toVector)
|
TypedCommand(run, cmd.mkString(" "), cmd.toVector)
|
||||||
|
|
||||||
|
def apply[T](exec: T => String, display: String, cmd: T) =
|
||||||
|
new TypedCommand(exec, display, cmd, false, false)
|
||||||
|
|
||||||
|
|
||||||
def shell(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
def shell(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||||
TypedCommand(runShell, cmd.mkString(" "), cmd.toVector)
|
TypedCommand(runShell, cmd.mkString(" "), cmd.toVector)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue