CommandSummary
A rendering of a dispatched command that is safe to log.
Source and package
- Qualified name
-
libtmux::command:: Command Summary - Module
- command
- Package
- libtmux
- Source
- crates/libtmux/src/command.rs
-
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#
- argument_count method Return the number of logical arguments after the subcommand.
- public_argument_count method Return the number of public logical arguments.
- sensitive_argument_count method Return the number of sensitive logical arguments.