1 use anyhow::Result; 2 use dadk_user::dadk_user_main; 3 4 use crate::{console::user::UserCommand, context::DADKExecContext}; 5 6 pub(super) fn run(ctx: &DADKExecContext, cmd: &UserCommand) -> Result<()> { 7 let config_dir = ctx.user_config_dir()?; 8 let cache_root_dir = ctx.cache_root_dir()?; 9 let sysroot_dir = ctx.sysroot_dir()?; 10 let dadk_user_action: dadk_user::context::Action = cmd.clone().into(); 11 12 let context = dadk_user::context::DadkUserExecuteContextBuilder::default() 13 .sysroot_dir(sysroot_dir) 14 .config_dir(config_dir) 15 .action(dadk_user_action) 16 .thread_num(1) 17 .cache_dir(cache_root_dir) 18 .target_arch(ctx.target_arch()) 19 .build() 20 .expect("Failed to build execute context"); 21 dadk_user_main(context); 22 Ok(()) 23 } 24