use crate::commands::command::RunnablePerItemContext; use crate::errors::ShellError; use crate::parser::hir::SyntaxType; use crate::parser::registry::{CommandRegistry, Signature}; use crate::prelude::*; use std::path::PathBuf; pub struct Cpy; #[derive(Deserialize)] pub struct CopyArgs { pub src: Tagged, pub dst: Tagged, pub recursive: Tagged, } impl PerItemCommand for Cpy { fn run( &self, call_info: &CallInfo, _registry: &CommandRegistry, shell_manager: &ShellManager, _input: Tagged, ) -> Result, ShellError> { call_info.process(shell_manager, cp)?.run() } fn name(&self) -> &str { "cp" } fn signature(&self) -> Signature { Signature::build("cp") .required("src", SyntaxType::Path) .required("dst", SyntaxType::Path) .named("file", SyntaxType::Any) .switch("recursive") } } fn cp( args: CopyArgs, context: &RunnablePerItemContext, ) -> Result, ShellError> { let shell_manager = context.shell_manager.clone(); shell_manager.cp(args, context) }