Merge pull request #8 from jonathandturner/path_completion

Add path completion to existing completions
This commit is contained in:
Jonathan Turner
2019-05-17 20:14:35 -07:00
committed by GitHub
4 changed files with 48 additions and 33 deletions

View File

@@ -1,6 +1,7 @@
use crate::errors::ShellError;
use crate::prelude::*;
use derive_new::new;
use std::env;
#[derive(new)]
pub struct Cd;
@@ -17,6 +18,7 @@ impl crate::Command for Cd {
let mut stream = VecDeque::new();
let path = dunce::canonicalize(cwd.join(&target).as_path())?;
let _ = env::set_current_dir(&path);
stream.push_back(ReturnValue::change_cwd(path));
Ok(stream)
}