diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2023-09-07 14:00:52 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2023-09-07 14:00:52 -0400 |
commit | cbd0e604a4109595419d3f82d52a13530e7db030 (patch) | |
tree | 22a72acc7cec96ac9d0554483283802b3a53097f /src | |
parent | 800a98f6746edde3c95157e233ef7201d830c595 (diff) |
cleanup config code
Diffstat (limited to 'src')
109 files changed, 1000 insertions, 887 deletions
diff --git a/src/commands/bookmark.rs b/src/commands/bookmark.rs index c810d56..1a33122 100644 --- a/src/commands/bookmark.rs +++ b/src/commands/bookmark.rs @@ -6,7 +6,8 @@ use ratatui::layout::Rect; use ratatui::widgets::Clear; use termion::event::Event; -use crate::config::{search_directories, BookmarkRaw, BookmarksRaw}; +use crate::config::raw::bookmarks::{BookmarkRaw, BookmarksRaw}; +use crate::config::search_directories; use crate::context::AppContext; use crate::error::JoshutoResult; use crate::event::{process_event, AppEvent}; diff --git a/src/commands/case_sensitivity.rs b/src/commands/case_sensitivity.rs index 658c7fe..f162ec9 100644 --- a/src/commands/case_sensitivity.rs +++ b/src/commands/case_sensitivity.rs @@ -1,4 +1,4 @@ -use crate::config::option::CaseSensitivity; +use crate::config::clean::app::search::CaseSensitivity; use crate::context::AppContext; use crate::error::JoshutoResult; diff --git a/src/commands/command_line.rs b/src/commands/command_line.rs index ae9b3af..72ba677 100644 --- a/src/commands/command_line.rs +++ b/src/commands/command_line.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use crate::config::AppKeyMapping; +use crate::config::clean::keymap::AppKeyMapping; use crate::context::AppContext; use crate::error::JoshutoResult; use crate::key_command::{AppExecute, Command}; diff --git a/src/commands/line_nums.rs b/src/commands/line_nums.rs index c5ff877..24e51b1 100644 --- a/src/commands/line_nums.rs +++ b/src/commands/line_nums.rs @@ -1,4 +1,4 @@ -use crate::config::option::LineNumberStyle; +use crate::config::clean::app::display::line_number::LineNumberStyle; use crate::context::AppContext; use crate::error::JoshutoResult; diff --git a/src/commands/linemode.rs b/src/commands/linemode.rs index 82668f6..92e63d1 100644 --- a/src/commands/linemode.rs +++ b/src/commands/linemode.rs @@ -1,5 +1,5 @@ use super::reload; -use crate::config::option::LineMode; +use crate::config::clean::app::display::line_mode::LineMode; use crate::context::AppContext; use crate::error::JoshutoResult; use crate::history::DirectoryHistory; diff --git a/src/commands/numbered_command.rs b/src/commands/numbered_command.rs index b66e38c..58f10a0 100644 --- a/src/commands/numbered_command.rs +++ b/src/commands/numbered_command.rs @@ -1,7 +1,7 @@ use termion::event::{Event, Key}; use crate::commands::cursor_move; -use crate::config::AppKeyMapping; +use crate::config::clean::keymap::AppKeyMapping; use crate::context::AppContext; use crate::error::{JoshutoError, JoshutoErrorKind, JoshutoResult}; use crate::event::process_event; diff --git a/src/commands/open_file.rs b/src/commands/open_file.rs index c93f721..90623b8 100644 --- a/src/commands/open_file.rs +++ b/src/commands/open_file.rs @@ -2,7 +2,7 @@ use std::io; use std::path; use crate::commands::{quit, reload}; -use crate::config::ProgramEntry; +use crate::config::clean::mimetype::ProgramEntry; use crate::context::AppContext; use crate::error::{JoshutoError, JoshutoErrorKind, JoshutoResult}; use crate::ui::views::DummyListener; diff --git a/src/commands/rename_file.rs b/src/commands/rename_file.rs index e98c598..13bb671 100644 --- a/src/commands/rename_file.rs +++ b/src/commands/rename_file.rs @@ -1,6 +1,6 @@ use std::path; -use crate::config::AppKeyMapping; +use crate::config::clean::keymap::AppKeyMapping; use crate::context::AppContext; use crate::error::JoshutoResult; use crate::history::create_dirlist_with_history; diff --git a/src/commands/search_fzf.rs b/src/commands/search_fzf.rs index 9d86b7b..dba5b18 100644 --- a/src/commands/search_fzf.rs +++ b/src/commands/search_fzf.rs @@ -3,7 +3,7 @@ use std::io::Write; use std::process::{Command, Stdio}; use crate::commands::cursor_move; -use crate::config::option::CaseSensitivity; +use crate::config::clean::app::search::CaseSensitivity; use crate::context::AppContext; use crate::error::{JoshutoError, JoshutoErrorKind, JoshutoResult}; use crate::ui::AppBackend; diff --git a/src/commands/select.rs b/src/commands/select.rs index 0ab3023..4fe3c9e 100644 --- a/src/commands/select.rs +++ b/src/commands/select.rs @@ -1,9 +1,35 @@ -use crate::config::option::SelectOption; use crate::context::{AppContext, MatchContext}; use crate::error::JoshutoResult; use super::cursor_move; +#[derive(Clone, Copy, Debug)] +pub struct SelectOption { + pub toggle: bool, + pub all: bool, + pub reverse: bool, +} + +impl std::default::Default for SelectOption { + fn default() -> Self { + Self { + toggle: true, + all: false, + reverse: false, + } + } +} + +impl std::fmt::Display for SelectOption { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!( + f, + "--toggle={} --all={} --deselect={}", + self.toggle, self.all, self.reverse + ) + } +} + pub fn select_files( context: &mut AppContext, pattern: &str, diff --git a/src/commands/show_help.rs b/src/commands/show_help.rs index 5d06105..140428a 100644 --- a/src/commands/show_help.rs +++ b/src/commands/show_help.rs @@ -2,7 +2,7 @@ use std::cmp::Ordering; use termion::event::{Event, Key}; -use crate::config::AppKeyMapping; +use crate::config::clean::keymap::AppKeyMapping; use crate::context::AppContext; use crate::error::JoshutoResult; use crate::event::process_event; diff --git a/src/commands/show_tasks.rs b/src/commands/show_tasks.rs index 4f70d7c..53db160 100644 --- a/src/commands/show_tasks.rs +++ b/src/commands/show_tasks.rs @@ -1,4 +1,4 @@ -use crate::config::AppKeyMapping; +use crate::config::clean::keymap::AppKeyMapping; |