Skip to content

Commit

Permalink
Refactor main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
bensadeh committed Oct 13, 2024
1 parent 36ee956 commit 584da26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/highlighter_builder/mod.rs → src/highlighter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod builtins;
pub mod groups;

use crate::highlighter_builder::builtins::get_builtin_keywords;
use crate::highlighter_builder::groups::HighlighterGroups;
use crate::highlighter::builtins::get_builtin_keywords;
use crate::highlighter::groups::HighlighterGroups;
use crate::theme::Theme;
use inlet_manifold::highlighter::HighlightBuilder;
use inlet_manifold::*;
Expand Down
19 changes: 6 additions & 13 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;
use rayon::iter::ParallelIterator;
mod cli;
mod config;
mod highlighter_builder;
mod highlighter;
mod io;
mod theme;

Expand All @@ -13,7 +13,7 @@ use crate::io::presenter::Present;
use crate::io::reader::AsyncLineReader;
use crate::io::writer::AsyncLineWriter;
use color_eyre::eyre::Result;
use highlighter_builder::groups;
use highlighter::groups;
use inlet_manifold::Highlighter;
use rayon::iter::IntoParallelIterator;
use theme::reader;
Expand All @@ -26,20 +26,13 @@ async fn main() -> Result<()> {

let cli = Cli::parse();

// let config = config::create_config_or_exit_early(&cli);
let config = config::create_config(&cli)?;

let highlighter_groups = groups::get_highlighter_groups(&cli.enable, &cli.disable)?;

let new_theme = reader::parse_theme(cli.config_path.clone())?;
let theme = reader::parse_theme(cli.config_path.clone())?;
let keywords_from_cli = get_keywords_from_cli(&cli);
let highlighter_groups = groups::get_highlighter_groups(&cli.enable, &cli.disable)?;

let highlighter = highlighter_builder::get_highlighter(
highlighter_groups,
new_theme,
keywords_from_cli,
cli.no_builtin_keywords,
)?;
let highlighter =
highlighter::get_highlighter(highlighter_groups, theme, keywords_from_cli, cli.no_builtin_keywords)?;

let (reached_eof_tx, reached_eof_rx) = oneshot::channel::<()>();
let (io, presenter) = get_io_and_presenter(config, Some(reached_eof_tx)).await;
Expand Down

0 comments on commit 584da26

Please sign in to comment.