Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

command.CommandSummary

Rust
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
command
Package
libtmux
Source
crates/libtmux/src/command.rs
struct command.CommandSummary
structoverload [source]
structoverload [source]
struct command.CommandSummary

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

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?;

3 declared, 0 inherited

Members

Esc

Type to search.