This commit is contained in:
Jonathan Turner 2019-08-22 07:38:09 +12:00
parent 73e3402e2f
commit 78ca297e47
2 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,8 @@ fn mkdir(
args: MkdirArgs,
context: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> {
println!("shell clone");
let shell_manager = context.shell_manager.clone();
println!("mkdir");
shell_manager.mkdir(args, context)
}

View File

@ -476,13 +476,14 @@ impl Shell for FilesystemShell {
fn mkdir(
&self,
MkdirArgs { rest: directories }: MkdirArgs,
mkdir_args: MkdirArgs,
RunnablePerItemContext {
name,
shell_manager,
..
}: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> {
println!("full path");
let full_path = PathBuf::from(shell_manager.path());
if directories.len() == 0 {
@ -493,13 +494,17 @@ impl Shell for FilesystemShell {
));
}
println!("dirs");
for dir in directories.iter() {
println!("create at:");
let create_at = {
let mut loc = full_path.clone();
loc.push(&dir.item);
loc
};
println!("{:?}", create_at);
match std::fs::create_dir_all(create_at) {
Err(reason) => {
return Err(ShellError::labeled_error(
@ -508,10 +513,15 @@ impl Shell for FilesystemShell {
dir.span(),
))
}
Ok(_) => {}
Ok(_) => {
println!("OK");
}
}
println!("End loop");
}
println!("Done");
Ok(VecDeque::new())
}