Added -j flag to 'complete' for completing job names/pids
This commit is contained in:
@@ -17,7 +17,7 @@ pub trait CharDequeUtils {
|
||||
pub trait TkVecUtils<Tk> {
|
||||
fn get_span(&self) -> Option<Span>;
|
||||
fn debug_tokens(&self);
|
||||
fn split_at_separators(&self) -> Vec<Vec<Tk>>;
|
||||
fn split_at_separators(&self) -> Vec<Vec<Tk>>;
|
||||
}
|
||||
|
||||
pub trait RedirVecUtils<Redir> {
|
||||
@@ -86,29 +86,24 @@ impl TkVecUtils<Tk> for Vec<Tk> {
|
||||
fn debug_tokens(&self) {
|
||||
for token in self {}
|
||||
}
|
||||
fn split_at_separators(&self) -> Vec<Vec<Tk>> {
|
||||
let mut splits = vec![];
|
||||
let mut cur_split = vec![];
|
||||
for tk in self {
|
||||
match tk.class {
|
||||
TkRule::Pipe |
|
||||
TkRule::ErrPipe |
|
||||
TkRule::And |
|
||||
TkRule::Or |
|
||||
TkRule::Bg |
|
||||
TkRule::Sep => {
|
||||
splits.push(std::mem::take(&mut cur_split));
|
||||
}
|
||||
_ => cur_split.push(tk.clone()),
|
||||
}
|
||||
}
|
||||
fn split_at_separators(&self) -> Vec<Vec<Tk>> {
|
||||
let mut splits = vec![];
|
||||
let mut cur_split = vec![];
|
||||
for tk in self {
|
||||
match tk.class {
|
||||
TkRule::Pipe | TkRule::ErrPipe | TkRule::And | TkRule::Or | TkRule::Bg | TkRule::Sep => {
|
||||
splits.push(std::mem::take(&mut cur_split));
|
||||
}
|
||||
_ => cur_split.push(tk.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
if !cur_split.is_empty() {
|
||||
splits.push(cur_split);
|
||||
}
|
||||
if !cur_split.is_empty() {
|
||||
splits.push(cur_split);
|
||||
}
|
||||
|
||||
splits
|
||||
}
|
||||
splits
|
||||
}
|
||||
}
|
||||
|
||||
impl RedirVecUtils<Redir> for Vec<Redir> {
|
||||
|
||||
Reference in New Issue
Block a user