Implemented functions and aliases
This commit is contained in:
@@ -99,9 +99,10 @@ impl<'a> ChildProc {
|
||||
} else {
|
||||
WtStat::Exited(pid, 0)
|
||||
};
|
||||
log!(DEBUG, command);
|
||||
let mut child = Self { pgid: pid, pid, command, stat };
|
||||
if let Some(pgid) = pgid {
|
||||
child.set_pgid(pgid)?;
|
||||
child.set_pgid(pgid).ok();
|
||||
}
|
||||
Ok(child)
|
||||
}
|
||||
@@ -345,14 +346,14 @@ impl Job {
|
||||
stat_line = format!("{}{} ",pid,stat_line);
|
||||
stat_line = format!("{} {}", stat_line, cmd);
|
||||
stat_line = match job_stat {
|
||||
WtStat::Stopped(..) | WtStat::Signaled(..) => style_text(stat_line, Style::Magenta),
|
||||
WtStat::Stopped(..) | WtStat::Signaled(..) => stat_line.styled(Style::Magenta),
|
||||
WtStat::Exited(_, code) => {
|
||||
match code {
|
||||
0 => style_text(stat_line, Style::Green),
|
||||
_ => style_text(stat_line, Style::Red),
|
||||
0 => stat_line.styled(Style::Green),
|
||||
_ => stat_line.styled(Style::Red),
|
||||
}
|
||||
}
|
||||
_ => style_text(stat_line, Style::Cyan)
|
||||
_ => stat_line.styled(Style::Cyan)
|
||||
};
|
||||
if i != self.get_cmds().len() - 1 {
|
||||
stat_line = format!("{} |",stat_line);
|
||||
|
||||
@@ -16,7 +16,13 @@ impl LogTab {
|
||||
pub fn get_alias(&self,name: &str) -> Option<&str> {
|
||||
self.aliases.get(name).map(|a| a.as_str())
|
||||
}
|
||||
pub fn set_alias(&mut self, name: &str, body: &str) {
|
||||
self.aliases.insert(name.to_string(),body.trim().to_string());
|
||||
}
|
||||
pub fn get_function(&self,name: &str) -> Option<&str> {
|
||||
self.functions.get(name).map(|a| a.as_str())
|
||||
}
|
||||
pub fn set_function(&mut self, name: &str, body: &str) {
|
||||
self.functions.insert(name.to_string(),body.trim().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ impl VarTab {
|
||||
env::set_var("HOME", home.clone());
|
||||
env_vars.insert("SHELL".into(), pathbuf_to_string(std::env::current_exe()));
|
||||
env::set_var("SHELL", pathbuf_to_string(std::env::current_exe()));
|
||||
env_vars.insert("HIST_FILE".into(),format!("{}/.fern_hist",home));
|
||||
env::set_var("HIST_FILE",format!("{}/.fern_hist",home));
|
||||
env_vars.insert("FERN_HIST".into(),format!("{}/.fern_hist",home));
|
||||
env::set_var("FERN_HIST",format!("{}/.fern_hist",home));
|
||||
|
||||
env_vars
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user