-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c07f0a
commit a4a8ed6
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//SPDX-FileCopyrightText: 2023 Ryuichi Ueda <ryuichiueda@gmail.com> | ||
//SPDX-License-Identifier: BSD-3-Clause | ||
|
||
use crate::{ShellCore, Feeder, Script}; | ||
use nix::unistd::Pid; | ||
use super::{Command, Pipe, Redirect}; | ||
|
||
#[derive(Debug)] | ||
pub struct IfCommand { | ||
pub text: String, | ||
pub if_elif_scripts: Vec<Script>, | ||
pub then_scripts: Vec<Script>, | ||
pub else_script: Option<Script>, | ||
pub redirects: Vec<Redirect>, | ||
force_fork: bool, | ||
} | ||
|
||
impl Command for IfCommand { | ||
fn exec(&mut self, _: &mut ShellCore, _: &mut Pipe) -> Option<Pid> {None} | ||
fn run_command(&mut self, _: &mut ShellCore, _: bool) {} | ||
fn get_text(&self) -> String { self.text.clone() } | ||
fn get_redirects(&mut self) -> &mut Vec<Redirect> { &mut self.redirects } | ||
fn set_force_fork(&mut self) { self.force_fork = true; } | ||
} | ||
|
||
impl IfCommand { | ||
pub fn parse(_: &mut Feeder, _: &mut ShellCore) -> Option<IfCommand> {None} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters