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.

struct libtmux-rs latest

CommandSummary

A rendering of a dispatched command that is safe to log.

Source and package
Qualified name
libtmux::command::CommandSummary
Module
command
Package
libtmux
Source
crates/libtmux/src/command.rs
struct command.CommandSummary

Description#

Every public token is ASCII escaped. Sensitive arguments are represented by a fixed marker that discloses neither their bytes nor their length.

Examples#

use libtmux::Command;
let guard = libtmux::test::TestServer::new().await?;
let result = guard
.server()
.cmd(
Command::new("set-environment")
.arg("-g")
.arg("TOKEN")
.sensitive_arg("hunter2"),
)
.await?;
// The subcommand is not an argument, so this counts `-g`, `TOKEN`, and
// the secret.
let summary = result.command();
assert_eq!(summary.argument_count(), 3);
assert_eq!(summary.public_argument_count(), 2);
// The secret is neither shown nor measurable from what is shown.
let rendered = summary.to_string();
assert!(!rendered.contains("hunter2"), "{rendered}");
assert!(!format!("{summary:?}").contains("hunter2"));
guard.shutdown().await?;

Members3#

Esc

Type to search.

Reference previewOpen reference