| Crates.io | printable-shell-command |
| lib.rs | printable-shell-command |
| version | 0.2.4 |
| created_at | 2025-10-03 04:48:04.948698+00 |
| updated_at | 2025-10-09 02:39:27.769732+00 |
| description | A helper library to print shell commands. |
| homepage | https://github.com/lgarron/printable-shell-command-rs |
| repository | https://github.com/lgarron/printable-shell-command-rs |
| max_upload_size | |
| id | 1866130 |
| size | 35,343 |
printable_shell_commandRust port of: https://github.com/lgarron/printable-shell-command
A helper library to print shell commands.
The goal is to make it easy to print commands that are being run by a program, in a way that makes it easy and safe for a user to copy-and-paste.
Command directlyuse std::process::Command;
use printable_shell_command::ShellPrintable;
fn main() {
let _ = Command::new("echo").args(["#hi"]).print_invocation();
}
Prints:
echo \
'#hi'
PrintableShellCommand to group argsuse printable_shell_command::{PrintableShellCommand, ShellPrintable};
fn main() {
let _ = PrintableShellCommand::new("ffmpeg")
.args(["-i", "./test/My video.mp4"])
.args(["-filter:v", "setpts=2.0*PTS"])
.args(["-filter:a", "atempo=0.5"])
.arg("./test/My video (slow-mo).mov")
.print_invocation()
.unwrap();
}
Prints:
ffmpeg \
-i './test/My video.mp4' \
-filter:v 'setpts=2.0*PTS' \
-filter:a atempo=0.5 \
'./test/My video (slow-mo).mov'