fix: ensure cursor is hidden again after interactive command
This commit is contained in:
parent
d6e24a2499
commit
0bcc8bc656
|
@ -97,7 +97,11 @@ object TypedCommand:
|
|||
c => runProcess(Vector(shell, "-c", c.mkString(" ")))
|
||||
|
||||
def runInteractive(using cwd: Path): Vector[String] => String =
|
||||
c => { os.proc(c).call(stdin = os.Inherit, stdout = os.Inherit, stderr = os.Inherit, cwd = cwd); "" }
|
||||
c =>
|
||||
Terminal.showCursor()
|
||||
os.proc(c).call(stdin = os.Inherit, stdout = os.Inherit, stderr = os.Inherit, cwd = cwd)
|
||||
Terminal.hideCursor()
|
||||
""
|
||||
|
||||
def apply(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||
TypedCommand(run, cmd.mkString(" "), cmd.toVector)
|
||||
|
@ -114,6 +118,9 @@ object TypedCommand:
|
|||
def interactive(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||
TypedCommand(runInteractive, cmd.mkString(" "), cmd.toVector)
|
||||
|
||||
def interactiveUntyped(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||
TypedCommand(runInteractive, cmd.mkString(" "), cmd.toVector, cmdIsHidden = true, outputIsHidden = false)
|
||||
|
||||
def untyped(cmd: String*)(using Path): TypedCommand[Vector[String]] =
|
||||
TypedCommand(exec = run, display = "", cmd.toVector, cmdIsHidden = true, outputIsHidden = false)
|
||||
end TypedCommand
|
||||
|
|
Loading…
Reference in a new issue