Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

class libtmux-java latest

TmuxFormats

Values handed to a tmux argument position that expands formats.

Source and package
Qualified name
io.github.libtmux.TmuxFormats
Package
io.github.libtmux
Distribution
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/TmuxFormats.java
class io.github.libtmux.TmuxFormats

Description#

tmux expands #{...} and #(...) in many argument positions, and #(...) runs a shell command. For the arguments this library composes itself — a window name, a pane title, a working directory — it applies #literal() at the construction boundary, so a caller's # stays a #.

It cannot do that for an argument the caller composes: Pane#pipeTo(), Window#displayPopup(), Shell#run(), Shell#capturing() and Shell#choose() all take a whole shell command, where format expansion is a documented tmux feature a caller may want — #{pane_id} in a filename, for instance. A caller interpolating an untrusted value into one of those needs #literal() on that value, which is why this is public.

Shell quoting does not substitute for it. tmux expands the format before the shell sees the string, so a #(...) inside single quotes still runs. Measured on tmux 3.7d, with the interpolated value quoted as a careful caller would quote it: run-shell executed it, and pipe-pane -O executed it as soon as the pane produced output.

Members3#

  • literal method Makes one caller value literal at one construction boundary.
  • printed method Text as tmux held it, from a line it printed.
  • storedNames method The names to look for when a caller names a session: the one this release stores for it, then the name exactly as given, which is what Session#name() already reports.
Esc

Type to search.

Reference previewOpen reference