Adding all commands and boilerplate

This commit is contained in:
2026-02-23 14:46:19 +00:00
parent 593ad42d3b
commit 26eccecc7c
6 changed files with 49 additions and 18 deletions
+8 -17
View File
@@ -12,23 +12,14 @@ use std::io::Write;
use std::path::PathBuf;
pub fn init(files: Vec<PathBuf>, message: String) -> Result<(), std::io::Error> {
// Convert PathBuf to &Path
let files = files.iter().map(|p| p.as_path()).collect();
// Check TOUR_DIR exists (it shouldn't because user calls init)
if fs::exists(TOUR_DIR)? {
panic!("{} folder exists", TOUR_DIR);
}
// Create dir recursively
fs::create_dir_all(format!("{}/{}", TOUR_DIR, "steps/0/files"))?;
// Copy files listed by command to step 0
let dest = format!("{}/steps/0/files/", TOUR_DIR);
copy_files(files, dest.as_ref())?;
// Copy message to step 0
let mut message_file = File::create("./.tour/steps/0/message")?;
write!(message_file, "{}", message)?;
// // Convert PathBuf to &Path
// let files = files.iter().map(|p| p.as_path()).collect();
//
// // Check TOUR_DIR exists (it shouldn't because user calls init)
// if fs::exists(TOUR_DIR)? {
// panic!("{} folder exists", TOUR_DIR);
// }
// // Create dir recursively
Ok(())
}