forked from extern/nushell
WIP
This commit is contained in:
parent
73e3402e2f
commit
78ca297e47
@ -35,6 +35,8 @@ fn mkdir(
|
|||||||
args: MkdirArgs,
|
args: MkdirArgs,
|
||||||
context: &RunnablePerItemContext,
|
context: &RunnablePerItemContext,
|
||||||
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
||||||
|
println!("shell clone");
|
||||||
let shell_manager = context.shell_manager.clone();
|
let shell_manager = context.shell_manager.clone();
|
||||||
|
println!("mkdir");
|
||||||
shell_manager.mkdir(args, context)
|
shell_manager.mkdir(args, context)
|
||||||
}
|
}
|
||||||
|
@ -476,13 +476,14 @@ impl Shell for FilesystemShell {
|
|||||||
|
|
||||||
fn mkdir(
|
fn mkdir(
|
||||||
&self,
|
&self,
|
||||||
MkdirArgs { rest: directories }: MkdirArgs,
|
mkdir_args: MkdirArgs,
|
||||||
RunnablePerItemContext {
|
RunnablePerItemContext {
|
||||||
name,
|
name,
|
||||||
shell_manager,
|
shell_manager,
|
||||||
..
|
..
|
||||||
}: &RunnablePerItemContext,
|
}: &RunnablePerItemContext,
|
||||||
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
||||||
|
println!("full path");
|
||||||
let full_path = PathBuf::from(shell_manager.path());
|
let full_path = PathBuf::from(shell_manager.path());
|
||||||
|
|
||||||
if directories.len() == 0 {
|
if directories.len() == 0 {
|
||||||
@ -493,13 +494,17 @@ impl Shell for FilesystemShell {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("dirs");
|
||||||
for dir in directories.iter() {
|
for dir in directories.iter() {
|
||||||
|
println!("create at:");
|
||||||
let create_at = {
|
let create_at = {
|
||||||
let mut loc = full_path.clone();
|
let mut loc = full_path.clone();
|
||||||
loc.push(&dir.item);
|
loc.push(&dir.item);
|
||||||
loc
|
loc
|
||||||
};
|
};
|
||||||
|
|
||||||
|
println!("{:?}", create_at);
|
||||||
|
|
||||||
match std::fs::create_dir_all(create_at) {
|
match std::fs::create_dir_all(create_at) {
|
||||||
Err(reason) => {
|
Err(reason) => {
|
||||||
return Err(ShellError::labeled_error(
|
return Err(ShellError::labeled_error(
|
||||||
@ -508,10 +513,15 @@ impl Shell for FilesystemShell {
|
|||||||
dir.span(),
|
dir.span(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
Ok(_) => {}
|
Ok(_) => {
|
||||||
|
println!("OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
println!("End loop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
println!("Done");
|
||||||
|
|
||||||
Ok(VecDeque::new())
|
Ok(VecDeque::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user