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.

method libtmux-rs latest

Server.command_prompt

Open a command prompt on a client.

Source and package
Qualified name
libtmux::server::Server::command_prompt
Module
server
Declared in
Server
Package
libtmux
Source
crates/libtmux/src/server/interactive.rs
Other languages
Perl Erlang PowerShell Julia Elixir Haskell Common Lisp Python Ruby Lua TypeScript Go Java C# C++ Swift Kotlin Scala OCaml F# Clojure
pub async fn command_prompt( &self, client: Option<&Client>, prompt: Option<&str>, command: impl Into<OsString>, ) -> Result<(), Error>

Description#

The prompt runs command once the user answers, with %% replaced by what they typed.

This does not return when the prompt opens. tmux holds the invocation until somebody answers or dismisses it, so a caller is waiting on a person -- and on a server nobody is watching, on nobody. The dispatch timeout is what ends that wait: with the default it fails after thirty seconds having opened a prompt that is still there. Give the call a server whose default_timeout() suits a human, or drive it from a task that may take that long.

Passing a client is not what decides this. Both forms wait; naming one only decides which terminal the prompt appears on.

Errors

Returns Error::ServerMismatch when the client belongs to another server, or an error when no suitable client exists, when tmux refuses, and when the dispatch timeout expires before the prompt is answered.

Parameters

tmux command#

The tmux commands behind command_prompt.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

Ask a client for input and run a command with it

Equivalents of Ask a client for input and run a command with it in other languages
Language Equivalent
Python libtmux.Server.command_prompt
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript no equivalent on Server
Go tmux.Server.CommandPrompt
Java no equivalent on Server
C# LibTmux.Server.ShowCommandPromptAsync
C++ no equivalent on Server
Swift no equivalent on Server
OCaml No direct public OCaml equivalent is recorded for this operation.
Perl No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands.

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference