From 8e5744cf9b32083cb862ff555aa60f9261f2b967 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 22 Aug 2019 04:00:29 +1200 Subject: [PATCH 1/2] Cleanup unneeded compiler flag --- src/commands/ps.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/ps.rs b/src/commands/ps.rs index 4913cb0a33..0dd9a1a6c9 100644 --- a/src/commands/ps.rs +++ b/src/commands/ps.rs @@ -2,8 +2,7 @@ use crate::commands::WholeStreamCommand; use crate::errors::ShellError; use crate::object::process::process_dict; use crate::prelude::*; -#[allow(unused)] -use sysinfo::{RefreshKind, SystemExt}; +use sysinfo::SystemExt; pub struct PS; @@ -35,6 +34,7 @@ fn ps(args: CommandArgs, _registry: &CommandRegistry) -> Result Date: Wed, 21 Aug 2019 11:23:26 -0500 Subject: [PATCH 2/2] Leave Nu's shell manager to figure out the suitable path for us instead. --- src/commands/cp.rs | 12 ++++++++---- src/commands/mv.rs | 19 ++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/commands/cp.rs b/src/commands/cp.rs index 5e1ac6d26f..5c3b5acc8d 100644 --- a/src/commands/cp.rs +++ b/src/commands/cp.rs @@ -45,11 +45,15 @@ fn cp( dst, recursive, }: CopyArgs, - RunnablePerItemContext { name, .. }: &RunnablePerItemContext, + context: &RunnablePerItemContext, ) -> Result, ShellError> { - let source = src.item.clone(); - let mut destination = dst.item.clone(); - let name_span = name; + let name_span = context.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()) { Ok(files) => files.collect(), diff --git a/src/commands/mv.rs b/src/commands/mv.rs index fc00248b4a..e9a0232234 100644 --- a/src/commands/mv.rs +++ b/src/commands/mv.rs @@ -38,14 +38,15 @@ impl PerItemCommand for Move { fn mv( MoveArgs { src, dst }: MoveArgs, - RunnablePerItemContext { - name, - shell_manager, - }: &RunnablePerItemContext, + context: &RunnablePerItemContext, ) -> Result, ShellError> { - let source = src.item.clone(); - let mut destination = dst.item.clone(); - let name_span = name; + let name_span = context.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()) { 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 = { match destination.file_name() { Some(name) => PathBuf::from(name),