-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinit_command.rs
More file actions
40 lines (33 loc) · 1.45 KB
/
init_command.rs
File metadata and controls
40 lines (33 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Docker init command example
//!
//! This example demonstrates how to use the `docker init` command to initialize
//! a project with Docker-related starter files.
//!
//! Run with: cargo run --example init_command
use docker_wrapper::{DockerCommand, InitCommand};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Docker Init Command Example");
println!("===========================\n");
// Get version information
println!("Getting docker init version...");
let version_output = InitCommand::new().version().execute().await?;
if let Some(version) = version_output.version() {
println!("Docker init version: {}\n", version);
} else {
println!("Could not retrieve version information\n");
}
// Show basic command construction
println!("Available commands:");
println!(" Basic init: {}", InitCommand::new());
println!(" Version: {}\n", InitCommand::new().version());
println!("Notes:");
println!("- The basic init command runs interactively");
println!("- It creates Dockerfile, compose.yaml, .dockerignore, and README.Docker.md");
println!("- Available templates: ASP.NET Core, Go, Java, Node, PHP, Python, Rust, Other");
println!("- Run in a project directory to initialize Docker support");
println!("\nExample usage in your project:");
println!(" cd /path/to/your/project");
println!(" docker init # Interactive mode");
Ok(())
}