Documentation
¶
Overview ¶
Package tl provides a unified API for opening a command in a new terminal window, tab, or pane across multiple terminal emulators and multiplexers.
Quick start:
err := tl.Launch([]string{"vim", "."}, tl.Options{
Target: tl.TargetTab,
})
The terminal is auto-detected from environment variables. If the requested target type (e.g. a pane split) is not supported, the library falls back gracefully to the next best option.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Target is where to open the command. Defaults to TargetTab.
Target Target
// Dir is the working directory for the new pane/tab/window.
// An empty string inherits the terminal's default (usually the current dir).
Dir string
// Name is a title hint for the new window, tab, or pane.
// Not all terminals honour this; it is applied on a best-effort basis.
Name string
}
Options configures how a command is launched.
type Target ¶
type Target int
Target describes where the new command should be opened.
const ( // TargetWindow opens a new top-level OS window. TargetWindow Target = iota // TargetTab opens a new tab inside the current window. TargetTab // TargetPaneVertical opens a vertical split (new pane to the right). TargetPaneVertical // TargetPaneHorizontal opens a horizontal split (new pane below). TargetPaneHorizontal )
func ParseTarget ¶
ParseTarget converts a string to a Target. Accepted values: "window" / "w", "tab" / "t", "pane-v" / "vsplit", "pane-h" / "hsplit".
Source Files
¶
Click to show internal directories.
Click to hide internal directories.