Enum Class Terminal
- All Implemented Interfaces:
Serializable,Comparable<Terminal>,Constable
A class enumerating all supported terminal applications.
Each terminal has its own way to wrap commands and how to call it.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe GNOME Console.The GNOME Terminal.The KDE Konsole.The macOS Terminal.The Windows Command Prompt.The Windows PowerShell. -
Method Summary
Modifier and TypeMethodDescriptionstatic TerminalReturns the default terminal application for the current operating system.static Terminal[]Gets the available terminal application options, depending on the current OS.toString()Returns the string representation name of the terminal application.static TerminalReturns the enum constant of this class with the specified name.static Terminal[]values()Returns an array containing the constants of this enum class, in the order they are declared.String[]wrapWithTerminalCommand(String cmdString, Path pwd) Wraps the givencmdStringinto an OS and terminal dependent command line.
-
Enum Constant Details
-
WINDOWS_CMD
The Windows Command Prompt. -
WINDOWS_POWERSHELL
The Windows PowerShell. -
GNOME_TERMINAL
The GNOME Terminal. -
GNOME_CONSOLE
The GNOME Console. -
KDE_KONSOLE
The KDE Konsole. -
MACOS_TERMINAL
The macOS Terminal.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
wrapWithTerminalCommand
Wraps the givencmdStringinto an OS and terminal dependent command line. The result can be passed to aProcessBuilderto open a terminal and run the command, allowing user input and showing process output.- Parameters:
cmdString- the command to be executed in the terminalpwd- the directory the terminal should run in- Returns:
- the array of strings forming the final executed command by the terminal
-
getSystemTerminalOptions
Gets the available terminal application options, depending on the current OS.- Returns:
- the array of available terminal applications
-
getDefaultSystemTerminal
Returns the default terminal application for the current operating system.- Returns:
- the first entry of the available terminal applications
-
toString
Returns the string representation name of the terminal application.
-