my_helper/cli/
commands.rs1use crate::core::copy::CopyService;
2use crate::core::JsonService;
3use crate::error::AppError;
4use std::path::PathBuf;
5
6pub struct CommandRunner {}
7
8impl CommandRunner {
9 pub fn new() -> Self {
10 Self {}
11 }
12
13 pub fn copy(
14 &self,
15 from: PathBuf,
16 to: PathBuf,
17 skip_exist: bool,
18 ignore_dirs: Option<Vec<String>>,
19 ) -> Result<(), AppError> {
20 CopyService::new(from, to, skip_exist, ignore_dirs).copy_file_to_target()
21 }
22
23 pub fn modify_json(
24 &self,
25 from: PathBuf,
26 to: PathBuf,
27 json_path: String,
28 skip_exist: bool,
29 ) -> Result<(), AppError> {
30 JsonService::new(from, to, json_path, skip_exist).modify_json()
31 }
32}