Browse Source

refactoring: sort imports

main
fdai7381 2 years ago
committed by fdai7451
parent
commit
b2e4dc5353
  1. 3
      src/builtins/cd.rs
  2. 9
      src/execute.rs
  3. 15
      src/main.rs

3
src/builtins/cd.rs

@ -1,9 +1,8 @@
use crate::builtins::{Builtin, BuiltinConfig};
use crate::error::ShellError;
use std::env::set_current_dir;
use std::path::Path;
use crate::error::ShellError;
pub struct Cd;
impl Builtin for Cd {

9
src/execute.rs

@ -1,12 +1,11 @@
use crossbeam_channel::{select, Receiver};
use std::io::ErrorKind;
use std::process::{Command, ExitStatus};
use std::{io, thread};
use crate::builtins::{execute_builtin, is_builtin, BuiltinConfig};
use crate::error::ShellError;
use crate::parse::parse_line;
use crate::preprocess::preprocess;
use crossbeam_channel::{select, Receiver};
use std::io::ErrorKind;
use std::process::{Command, ExitStatus};
use std::{io, thread};
/// This function is not directly in main.rs because it might be called by other function too (eg.
/// when piping commands).

15
src/main.rs

@ -1,11 +1,5 @@
mod builtins;
mod error;
mod execute;
mod parse;
mod preprocess;
mod prompt;
use crate::builtins::BuiltinConfig;
use crate::prompt::Prompt;
use colored::*;
use execute::interpret;
use rustyline::config::Configurer;
@ -13,7 +7,12 @@ use rustyline::error::ReadlineError;
use rustyline::{Editor, Result};
use whoami::username;
use crate::prompt::Prompt;
mod builtins;
mod error;
mod execute;
mod parse;
mod preprocess;
mod prompt;
fn main() -> Result<()> {
let (ctrlc_send, ctrlc_recv) = crossbeam_channel::unbounded::<()>();

Loading…
Cancel
Save