pub struct PsCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker ps command builder with fluent API
Fields§
§executor: CommandExecutor
Command executor for extensibility
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();
Sourcepub fn quiet(self) -> Self
pub fn quiet(self) -> Self
Only display container IDs
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().quiet();
Sourcepub fn size(self) -> Self
pub fn size(self) -> Self
Display total file sizes
§Examples
use docker_wrapper::PsCommand;
let ps_cmd = PsCommand::new().size();
Sourcepub fn get_executor(&self) -> &CommandExecutor
pub fn get_executor(&self) -> &CommandExecutor
Gets the command executor
Sourcepub fn get_executor_mut(&mut self) -> &mut CommandExecutor
pub fn get_executor_mut(&mut self) -> &mut CommandExecutor
Gets the command executor mutably
Sourcepub fn build_command_args(&self) -> Vec<String>
pub fn build_command_args(&self) -> Vec<String>
Builds the command arguments for Docker ps
Trait Implementations§
Source§impl DockerCommand for PsCommand
impl DockerCommand for PsCommand
Source§fn get_executor(&self) -> &CommandExecutor
fn get_executor(&self) -> &CommandExecutor
Get the command executor for extensibility
Source§fn get_executor_mut(&mut self) -> &mut CommandExecutor
fn get_executor_mut(&mut self) -> &mut CommandExecutor
Get mutable command executor for extensibility
Source§fn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the complete command arguments including subcommands
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 execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Helper method to execute the command with proper error handling
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