refactor: move packager cli handle and module into general for better organization

This commit is contained in:
Noor 2025-03-20 21:57:29 +05:30
parent 36df27f3e6
commit 8936d19c39
Signed by: noormohammedb
GPG Key ID: D83EFB8B3B967146
5 changed files with 8 additions and 9 deletions

@ -1,10 +1,9 @@
use clap::{builder::PossibleValue, Arg, ArgMatches, Command}; use clap::{builder::PossibleValue, Arg, ArgMatches, Command};
use clap_complete::{generate, Shell}; use clap_complete::{generate, Shell};
use detee_cli::general::cli_handler::handle_operators; use detee_cli::general::cli_handler::{handle_operators, handle_packagers};
use detee_cli::sgx::cli_handler::handle_app; use detee_cli::sgx::cli_handler::handle_app;
use detee_cli::snp::cli_handler::{handle_vm, handle_vm_nodes}; use detee_cli::snp::cli_handler::{handle_vm, handle_vm_nodes};
use detee_cli::*; use detee_cli::*;
use std::error::Error;
use std::io; use std::io;
const ABOUT: &str = r#"The DeTEE CLI allows you to manage and deploy applications and virtual machines. const ABOUT: &str = r#"The DeTEE CLI allows you to manage and deploy applications and virtual machines.
@ -618,9 +617,3 @@ fn handle_account(matches: &ArgMatches) {
_ => cli_print(Ok(config::Config::get_account_data())), _ => cli_print(Ok(config::Config::get_account_data())),
} }
} }
fn handle_packagers(
_matches: &ArgMatches,
) -> Result<Vec<crate::packagers::Packager>, Box<dyn Error>> {
Ok(crate::packagers::get_packagers())
}

@ -1,6 +1,8 @@
use super::operators; use super::operators;
use super::packagers;
use crate::{cli_print, config}; use crate::{cli_print, config};
use clap::ArgMatches; use clap::ArgMatches;
use std::error::Error;
pub fn handle_operators(matches: &ArgMatches) { pub fn handle_operators(matches: &ArgMatches) {
match matches.subcommand() { match matches.subcommand() {
@ -34,3 +36,7 @@ pub fn handle_operators(matches: &ArgMatches) {
_ => println!("To get more information about operators, use: detee-cli operator --help"), _ => println!("To get more information about operators, use: detee-cli operator --help"),
} }
} }
pub fn handle_packagers(_matches: &ArgMatches) -> Result<Vec<packagers::Packager>, Box<dyn Error>> {
Ok(packagers::get_packagers())
}

@ -1,3 +1,4 @@
pub mod cli_handler; pub mod cli_handler;
pub mod operators; pub mod operators;
pub mod packagers;
// pub mod grpc; // pub mod grpc;

@ -2,7 +2,6 @@ pub mod config;
pub mod constants; pub mod constants;
pub mod general; pub mod general;
pub mod name_generator; pub mod name_generator;
pub mod packagers;
pub mod sgx; pub mod sgx;
pub mod snp; pub mod snp;
pub mod utils; pub mod utils;