forked from extern/nushell
Merge pull request #328 from androbtech/back-to-shellmanager
Leave Nu's shell manager to figure out the suitable path for us instead.
This commit is contained in:
commit
990c0cc28b
@ -45,11 +45,15 @@ fn cp(
|
|||||||
dst,
|
dst,
|
||||||
recursive,
|
recursive,
|
||||||
}: CopyArgs,
|
}: CopyArgs,
|
||||||
RunnablePerItemContext { name, .. }: &RunnablePerItemContext,
|
context: &RunnablePerItemContext,
|
||||||
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
||||||
let source = src.item.clone();
|
let name_span = context.name;
|
||||||
let mut destination = dst.item.clone();
|
|
||||||
let name_span = name;
|
let mut source = PathBuf::from(context.shell_manager.path());
|
||||||
|
let mut destination = PathBuf::from(context.shell_manager.path());
|
||||||
|
|
||||||
|
source.push(&src.item);
|
||||||
|
destination.push(&dst.item);
|
||||||
|
|
||||||
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
|
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
|
||||||
Ok(files) => files.collect(),
|
Ok(files) => files.collect(),
|
||||||
|
@ -38,14 +38,15 @@ impl PerItemCommand for Move {
|
|||||||
|
|
||||||
fn mv(
|
fn mv(
|
||||||
MoveArgs { src, dst }: MoveArgs,
|
MoveArgs { src, dst }: MoveArgs,
|
||||||
RunnablePerItemContext {
|
context: &RunnablePerItemContext,
|
||||||
name,
|
|
||||||
shell_manager,
|
|
||||||
}: &RunnablePerItemContext,
|
|
||||||
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
) -> Result<VecDeque<ReturnValue>, ShellError> {
|
||||||
let source = src.item.clone();
|
let name_span = context.name;
|
||||||
let mut destination = dst.item.clone();
|
|
||||||
let name_span = name;
|
let mut source = PathBuf::from(context.shell_manager.path());
|
||||||
|
let mut destination = PathBuf::from(context.shell_manager.path());
|
||||||
|
|
||||||
|
source.push(&src.item);
|
||||||
|
destination.push(&dst.item);
|
||||||
|
|
||||||
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
|
let sources: Vec<_> = match glob::glob(&source.to_string_lossy()) {
|
||||||
Ok(files) => files.collect(),
|
Ok(files) => files.collect(),
|
||||||
@ -58,10 +59,6 @@ fn mv(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if "." == destination.to_string_lossy() {
|
|
||||||
destination = PathBuf::from(shell_manager.path());
|
|
||||||
}
|
|
||||||
|
|
||||||
let destination_file_name = {
|
let destination_file_name = {
|
||||||
match destination.file_name() {
|
match destination.file_name() {
|
||||||
Some(name) => PathBuf::from(name),
|
Some(name) => PathBuf::from(name),
|
||||||
|
Loading…
Reference in New Issue
Block a user