Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 17, 2025
1 parent 8f077e0 commit 4249e4c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
//SPDX-License-Identifier: BSD-3-Clause

pub mod exec;
pub mod input;
pub mod parse;

use crate::ShellCore;
use nix::sys::signal::Signal;
use nix::unistd::Pid;

/*
#[derive(Debug)]
pub enum InputError {
Interrupt,
Eof,
}
*/

pub fn print(s: &str, core: &mut ShellCore) {
let name = core.db.get_param("0").unwrap();
Expand Down
8 changes: 8 additions & 0 deletions src/error/input.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//SPDX-FileCopyrightText: 2024 Ryuichi Ueda [email protected]
//SPDX-License-Identifier: BSD-3-Clause

#[derive(Debug)]
pub enum InputError {
Interrupt,
Eof,
}
2 changes: 1 addition & 1 deletion src/feeder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::fs::File;
use std::io::{BufRead, BufReader, Lines};
use crate::ShellCore;
use crate::utils::exit;
use crate::error::InputError;
use crate::error::input::InputError;
use crate::error::parse::ParseError;
use std::sync::atomic::Ordering::Relaxed;

Expand Down
2 changes: 1 addition & 1 deletion src/feeder/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod completion;

use crate::{file_check, ShellCore};
use crate::utils::file;
use crate::error::{InputError};
use crate::error::input::InputError;
use std::io;
use std::fs::File;
use std::io::{Write, Stdout};
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::error::exec;
use crate::elements::script::Script;
use crate::feeder::Feeder;
use utils::{exit, file_check, arg};
use error::InputError;
use error::input::InputError;

fn show_version() {
const V: &'static str = env!("CARGO_PKG_VERSION");
Expand Down
2 changes: 1 addition & 1 deletion test/ok
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
./test_builtins.bash
./test_others.bash
./test_calculation.bash
./test_compound.bash
./test_parameters.bash
./test_compound.bash
./test_job.bash

0 comments on commit 4249e4c

Please sign in to comment.