From b2e4dc53533b6d6e5ac85418bdc2bcf8b3ed48e7 Mon Sep 17 00:00:00 2001 From: fdai7381 Date: Mon, 23 Jan 2023 00:22:36 +0100 Subject: [PATCH] refactoring: sort imports --- src/builtins/cd.rs | 3 +-- src/execute.rs | 9 ++++----- src/main.rs | 15 +++++++-------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/builtins/cd.rs b/src/builtins/cd.rs index 5fea769..0ec97ab 100644 --- a/src/builtins/cd.rs +++ b/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 { diff --git a/src/execute.rs b/src/execute.rs index 49b6a1a..566e055 100644 --- a/src/execute.rs +++ b/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). diff --git a/src/main.rs b/src/main.rs index aaf13a8..73e605a 100644 --- a/src/main.rs +++ b/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::<()>();