Skip to content

Commit

Permalink
Merge branch 'sd/202409_2' into sd/202409_3
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 23, 2024
2 parents ee9a5c9 + f273b26 commit c3b118c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/elements/command/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub struct SimpleCommand {

impl Command for SimpleCommand {
fn exec(&mut self, core: &mut ShellCore, pipe: &mut Pipe) -> Option<Pid> {
if self.words.len() == 0 {
return None;
}
self.args = self.words.iter()
.filter(|w| w.text != "")
.map(|w| w.text.clone()).collect();

for a in &mut self.words {
self.args.extend(a.get_args());
if self.args.len() == 0 {
return None;
}

if self.force_fork
Expand Down
1 change: 0 additions & 1 deletion src/elements/subword.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ impl Debug for dyn Subword {

pub trait Subword {
fn get_text(&self) -> String;
fn eval(&mut self) -> Vec<Vec<String>>;
}

pub fn parse(feeder: &mut Feeder, core: &mut ShellCore) -> Option<Box<dyn Subword>> {
Expand Down
1 change: 0 additions & 1 deletion src/elements/subword/brace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pub struct BraceSubword {

impl Subword for BraceSubword {
fn get_text(&self) -> String { self.text.clone() }
fn eval(&mut self) -> Vec<Vec<String>> { vec![vec![self.text.clone()]] }
}

impl BraceSubword {
Expand Down
1 change: 0 additions & 1 deletion src/elements/subword/unquoted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub struct UnquotedSubword {

impl Subword for UnquotedSubword {
fn get_text(&self) -> String { self.text.clone() }
fn eval(&mut self) -> Vec<Vec<String>> { vec![vec![self.text.clone()]] }
}

impl UnquotedSubword {
Expand Down
6 changes: 1 addition & 5 deletions src/elements/word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ pub struct Word {
}

impl Word {
fn new() -> Word {
pub fn new() -> Word {
Word {
text: String::new(),
subwords: vec![],
}
}

pub fn get_args(&mut self) -> Vec<String> {
vec![self.text.clone()]
}

pub fn parse(feeder: &mut Feeder, core: &mut ShellCore) -> Option<Word> {
let mut ans = Word::new();
while let Some(sw) = subword::parse(feeder, core) {
Expand Down

0 comments on commit c3b118c

Please sign in to comment.