diff --git a/src/changevm.rs b/src/commands/changevm.rs similarity index 100% rename from src/changevm.rs rename to src/commands/changevm.rs diff --git a/src/config.rs b/src/commands/config.rs similarity index 100% rename from src/config.rs rename to src/commands/config.rs diff --git a/src/create.rs b/src/commands/create.rs similarity index 97% rename from src/create.rs rename to src/commands/create.rs index bc1bf8b..4040983 100644 --- a/src/create.rs +++ b/src/commands/create.rs @@ -8,8 +8,10 @@ use std::io::Write; use std::path::Path; use std::process::Command; -use super::utils::{get_buildah_args, mount_container, umount_container, BuildahCommand}; -use crate::utils::{path_pairs_to_hash_map, port_pairs_to_hash_map, PathPair, PortPair}; +use crate::utils::{ + get_buildah_args, mount_container, path_pairs_to_hash_map, port_pairs_to_hash_map, + umount_container, BuildahCommand, PathPair, PortPair, +}; use crate::{KrunvmConfig, VmConfig, APP_NAME}; #[cfg(target_os = "macos")] diff --git a/src/delete.rs b/src/commands/delete.rs similarity index 92% rename from src/delete.rs rename to src/commands/delete.rs index acb1b7f..2f4c54a 100644 --- a/src/delete.rs +++ b/src/commands/delete.rs @@ -4,7 +4,7 @@ use crate::{KrunvmConfig, APP_NAME}; use clap::Args; -use super::utils::{remove_container, umount_container}; +use crate::utils::{remove_container, umount_container}; /// Delete an existing microVM #[derive(Args, Debug)] diff --git a/src/list.rs b/src/commands/list.rs similarity index 100% rename from src/list.rs rename to src/commands/list.rs diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000..256e206 --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1,13 @@ +mod changevm; +mod config; +mod create; +mod delete; +mod list; +mod start; + +pub use changevm::ChangeVmCmd; +pub use config::ConfigCmd; +pub use create::CreateCmd; +pub use delete::DeleteCmd; +pub use list::ListCmd; +pub use start::StartCmd; diff --git a/src/start.rs b/src/commands/start.rs similarity index 98% rename from src/start.rs rename to src/commands/start.rs index 0d7823b..2d67423 100644 --- a/src/start.rs +++ b/src/commands/start.rs @@ -11,8 +11,8 @@ use std::os::unix::io::AsRawFd; #[cfg(target_os = "macos")] use std::path::Path; -use super::bindings; -use super::utils::{mount_container, umount_container}; +use crate::bindings; +use crate::utils::{mount_container, umount_container}; use crate::{KrunvmConfig, VmConfig}; #[derive(Args, Debug)] diff --git a/src/main.rs b/src/main.rs index abf2b3a..0531136 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,24 +7,15 @@ use std::fs::File; #[cfg(target_os = "macos")] use std::io::{self, Read, Write}; -use crate::changevm::ChangeVmCmd; -use crate::config::ConfigCmd; -use crate::create::CreateCmd; -use crate::delete::DeleteCmd; -use crate::list::ListCmd; -use crate::start::StartCmd; +use crate::commands::{ChangeVmCmd, ConfigCmd, CreateCmd, DeleteCmd, ListCmd, StartCmd}; use clap::{Parser, Subcommand}; use serde_derive::{Deserialize, Serialize}; #[cfg(target_os = "macos")] use text_io::read; + #[allow(unused)] mod bindings; -mod changevm; -mod config; -mod create; -mod delete; -mod list; -mod start; +mod commands; mod utils; const APP_NAME: &str = "krunvm";