pub struct PsCommand { /* private fields */ }
Expand description
Docker ps command builder with fluent API
Implementations§
Source§impl PsCommand
impl PsCommand
Sourcepub fn all(self) -> Self
pub fn all(self) -> Self
Show all containers (default shows just running)
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().all();
Sourcepub fn filter(self, filter: impl Into<String>) -> Self
pub fn filter(self, filter: impl Into<String>) -> Self
Filter output based on conditions provided
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new()
.filter("status=running")
.filter("name=my-container");
Sourcepub fn filters(self, filters: Vec<String>) -> Self
pub fn filters(self, filters: Vec<String>) -> Self
Add multiple filters
§Examples
use docker_wrapper::PsCommand;
let filters = vec!["status=running".to_string(), "name=web".to_string()];
let ps_cmd = PsCommand::new().filters(filters);
Sourcepub fn format_table(self) -> Self
pub fn format_table(self) -> Self
Format output using table format
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().format_table();
Sourcepub fn format_json(self) -> Self
pub fn format_json(self) -> Self
Format output using JSON format
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().format_json();
Sourcepub fn format_template(self, template: impl Into<String>) -> Self
pub fn format_template(self, template: impl Into<String>) -> Self
Format output using a custom Go template
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new()
.format_template("table {{.ID}}\\t{{.Names}}\\t{{.Status}}");
Sourcepub fn last(self, n: i32) -> Self
pub fn last(self, n: i32) -> Self
Show n last created containers (includes all states)
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().last(5);
Sourcepub fn latest(self) -> Self
pub fn latest(self) -> Self
Show the latest created container (includes all states)
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().latest();
Sourcepub fn no_trunc(self) -> Self
pub fn no_trunc(self) -> Self
Don’t truncate output
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().no_trunc();
Trait Implementations§
Source§impl DockerCommand for PsCommand
impl DockerCommand for PsCommand
Source§fn command_name(&self) -> &'static str
fn command_name(&self) -> &'static str
Get the command name (e.g., “run”, “exec”, “ps”)
Source§fn build_args(&self) -> Vec<String>
fn build_args(&self) -> Vec<String>
Build the command arguments
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the command and return the typed output
Source§fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
Add a raw argument to the command (escape hatch)
Auto Trait Implementations§
impl Freeze for PsCommand
impl RefUnwindSafe for PsCommand
impl Send for PsCommand
impl Sync for PsCommand
impl Unpin for PsCommand
impl UnwindSafe for PsCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more