Merge master

This commit is contained in:
Jonathan Turner 2019-08-22 05:09:23 +12:00
commit 73e3402e2f
2 changed files with 24 additions and 20 deletions

View File

@ -2,8 +2,7 @@ use crate::commands::WholeStreamCommand;
use crate::errors::ShellError; use crate::errors::ShellError;
use crate::object::process::process_dict; use crate::object::process::process_dict;
use crate::prelude::*; use crate::prelude::*;
#[allow(unused)] use sysinfo::SystemExt;
use sysinfo::{RefreshKind, SystemExt};
pub struct PS; pub struct PS;
@ -35,6 +34,7 @@ fn ps(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream, Sh
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
{ {
use sysinfo::RefreshKind;
let mut sy = sysinfo::System::new_with_specifics(RefreshKind::new().with_processes()); let mut sy = sysinfo::System::new_with_specifics(RefreshKind::new().with_processes());
sy.refresh_processes(); sy.refresh_processes();

View File

@ -200,11 +200,15 @@ impl Shell for FilesystemShell {
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(),
@ -514,14 +518,15 @@ impl Shell for FilesystemShell {
fn mv( fn mv(
&self, &self,
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(),
@ -534,10 +539,6 @@ impl Shell for FilesystemShell {
} }
}; };
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),
@ -821,10 +822,13 @@ impl Shell for FilesystemShell {
fn rm( fn rm(
&self, &self,
RemoveArgs { target, recursive }: RemoveArgs, RemoveArgs { target, recursive }: RemoveArgs,
RunnablePerItemContext { name, .. }: &RunnablePerItemContext, context: &RunnablePerItemContext,
) -> Result<VecDeque<ReturnValue>, ShellError> { ) -> Result<VecDeque<ReturnValue>, ShellError> {
let path = target.item.clone(); let name_span = context.name;
let name_span = name;
let mut path = PathBuf::from(context.shell_manager.path());
path.push(&target.item);
let file = path.to_string_lossy(); let file = path.to_string_lossy();