TmuxFormats
Values handed to a tmux argument position that expands formats.
Source and package
- Qualified name
-
io.github .libtmux. Tmux Formats - Package
- io.github.libtmux
- Distribution
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/TmuxFormats.java
-
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()andShell#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-shellexecuted it, andpipe-pane -Oexecuted 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.