Package io.github.jbastgen.stemma.app.io
Class TerminalLauncher
java.lang.Object
io.github.jbastgen.stemma.app.io.TerminalLauncher
Opens a terminal in a folder (feature 11). The terminal is the one the user chose, or the first that is installed;
a command of the user's own (
$DIR stands for the folder) replaces all of that. Commands are started without a
shell and with the folder as working directory, so paths with spaces or quotes are safe.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat to run.static final recordstatic interfaceStarts a command in a folder.static enumA terminal program Stemma knows how to start in a folder. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleaninstalled(FileManager.Os os, TerminalLauncher.Terminal t, Map<String, String> env) Whether the terminal's program is installed: an application bundle on macOS, a program on the path elsewhere.static TerminalLauncher.Resultopen(FileManager.Os os, Path dir, String choice, String template, Predicate<TerminalLauncher.Terminal> installed, TerminalLauncher.Starter starter) Opens a terminal indir; blocks for at most a few seconds, so call it off the UI thread.static TerminalLauncher.ResultOpens a terminal indiron this computer.static TerminalLauncher.Planplan(FileManager.Os os, Path dir, String choice, String template, Predicate<TerminalLauncher.Terminal> installed) Decides what to run.static TerminalLauncher.StarterStarts the program with the folder as working directory, discards its output and waits a few seconds.
-
Field Details
-
AUTO
The key in the settings that means "the first one that is installed".- See Also:
-
-
Method Details
-
installed
public static boolean installed(FileManager.Os os, TerminalLauncher.Terminal t, Map<String, String> env) Whether the terminal's program is installed: an application bundle on macOS, a program on the path elsewhere. -
plan
public static TerminalLauncher.Plan plan(FileManager.Os os, Path dir, String choice, String template, Predicate<TerminalLauncher.Terminal> installed) Decides what to run. A non-blanktemplatewins ($DIRor${DIR}is the folder). Else the chosen terminal, if it is installed, else the first installed one of the system. Null when there is none. -
open
public static TerminalLauncher.Result open(FileManager.Os os, Path dir, String choice, String template, Predicate<TerminalLauncher.Terminal> installed, TerminalLauncher.Starter starter) Opens a terminal indir; blocks for at most a few seconds, so call it off the UI thread. -
open
Opens a terminal indiron this computer. -
processStarter
Starts the program with the folder as working directory, discards its output and waits a few seconds.
-