Can now grep the history :D
This commit is contained in:
parent
d768ee38b2
commit
981cebea5b
@ -5,7 +5,6 @@ TODO:
|
||||
* Aliases don't currently handle arguments. My alias "vless" does not work with "vless lib.rs"
|
||||
* A shortcut / implemented command to show all Hotkeys
|
||||
* git commit -m "message" does not work
|
||||
* Impossible to grep history / maybe implement Ctrl+R ?
|
||||
* Can't cd to a directory containing spaces in its name
|
||||
* Startup script section in sqishrc
|
||||
|
||||
|
17
src/lib.rs
17
src/lib.rs
@ -8,6 +8,7 @@ pub mod shell {
|
||||
use std::path::Path;
|
||||
use std::env;
|
||||
use std::str;
|
||||
use std::fs::File;
|
||||
use std::process::Stdio;
|
||||
use termion::event::Key;
|
||||
use termion::input::TermRead;
|
||||
@ -60,15 +61,17 @@ pub mod shell {
|
||||
//let stdout = Stdio::inherit();
|
||||
let res = get_history();
|
||||
match res {
|
||||
Ok(r) => println!("{}", r),
|
||||
Err(e) => eprintln!(" Err: {}", e),
|
||||
Ok(r) => {
|
||||
let filepath = dirs::home_dir().unwrap().join(".history.sqish");
|
||||
let file = File::open(filepath).unwrap();
|
||||
*&mut previous_command = Some(Stdio::from(file));
|
||||
if !commands.peek().is_some() {
|
||||
print!("{}", r);
|
||||
}
|
||||
},
|
||||
Err(e) => eprintln!(" Err reading history: {}", e),
|
||||
}
|
||||
},
|
||||
// "ssh" => {
|
||||
// let ssh_args = args.peekable().peek().map_or(" ", |x| *x);
|
||||
// let mut child = Command::new("ssh").arg(ssh_args).spawn().unwrap();
|
||||
// let _ = child.wait().unwrap();
|
||||
// },
|
||||
command => {
|
||||
if commands.peek().is_some() {
|
||||
let stdin = match previous_command {
|
||||
|
Loading…
x
Reference in New Issue
Block a user