add command works ,fix warnings, proxy repaired, docker start arguments defined
This commit is contained in:
91
src/main.rs
91
src/main.rs
@ -6,25 +6,10 @@
|
||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/05/29 21:22:17 by tomoron #+# #+# */
|
||||
/* Updated: 2026/06/05 00:11:54 by tomoron ### ########.fr */
|
||||
/* Updated: 2026/06/05 17:48:58 by tomoron ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
use tokio::io;
|
||||
//use bollard::{
|
||||
// query_parameters::{
|
||||
// ListImagesOptionsBuilder,
|
||||
// ListContainersOptionsBuilder,
|
||||
// CreateContainerOptionsBuilder
|
||||
// },
|
||||
// models::{
|
||||
// ContainerCreateBody
|
||||
// },
|
||||
// Docker
|
||||
//};
|
||||
|
||||
|
||||
|
||||
mod minecraft;
|
||||
use minecraft::mc_socket_listen;
|
||||
|
||||
@ -38,9 +23,10 @@ pub mod models;
|
||||
pub mod status;
|
||||
|
||||
mod cli;
|
||||
|
||||
use cli::*;
|
||||
|
||||
mod config;
|
||||
pub use config::Config;
|
||||
|
||||
pub type DbPool = Pool<ConnectionManager<PgConnection>>;
|
||||
|
||||
@ -54,8 +40,7 @@ fn get_connection_pool() -> DbPool {
|
||||
}
|
||||
|
||||
|
||||
use clap::{Command, arg};
|
||||
|
||||
use clap::Command;
|
||||
|
||||
fn cli() -> Command {
|
||||
Command::new("dmm")
|
||||
@ -64,7 +49,7 @@ fn cli() -> Command {
|
||||
.arg_required_else_help(true)
|
||||
.subcommand(
|
||||
Command::new("serverMode")
|
||||
.about("start the server manager")
|
||||
.about("Start the server manager")
|
||||
|
||||
)
|
||||
.subcommand(add::create_subcommand())
|
||||
@ -80,72 +65,8 @@ async fn main() -> Result<(), String> {
|
||||
|
||||
match arg.subcommand() {
|
||||
Some(("serverMode", _)) => { mc_socket_listen(pool).await.map_err(|_| "socket error".to_string())?; },
|
||||
Some(("add", sub_matches)) => { add::subcommand(sub_matches)?; },
|
||||
Some(("add", sub_matches)) => { add::subcommand(sub_matches, pool).await?; },
|
||||
_ => {panic!("subcommand not implemented")}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
println!("{:?}", docker);
|
||||
let options = ListImagesOptionsBuilder::default()
|
||||
.all(true)
|
||||
.build();
|
||||
let images = &docker.list_images(Some(options)).await.unwrap();
|
||||
println!("\n\nimages : {:?}", images);
|
||||
|
||||
let options = ListContainersOptionsBuilder::default()
|
||||
.all(true)
|
||||
.build();
|
||||
|
||||
let containers = docker.list_containers(Some(options)).await.unwrap();
|
||||
println!("\n\ncontainers : {:?}", containers);
|
||||
|
||||
let options = CreateContainerOptionsBuilder::default()
|
||||
.name("rust-created-container")
|
||||
.build();
|
||||
|
||||
let config = ContainerCreateBody {
|
||||
image: Some("hello-world".to_string()),
|
||||
// cmd: Some(vc pec!["/hello".to_string()]),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let container = docker.create_container(Some(options), config).await.unwrap();
|
||||
|
||||
let start_res = docker.start_container("rust-created-container", None).await;
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user