refactor: Improved error handling project-wide and cleaned up some regexes with unnecessary escapes (tail_logs and interpolate_env_vars)
This commit is contained in:
@@ -80,13 +80,19 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Fill(0)])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let block_content = &app.data.radarr_data.add_movie_search.as_ref().unwrap().text;
|
||||
let block_content = &app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_search
|
||||
.as_ref()
|
||||
.expect("add_movie_search must be populated")
|
||||
.text;
|
||||
let offset = app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_search
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_movie_search must be populated")
|
||||
.offset
|
||||
.load(Ordering::SeqCst);
|
||||
let search_results_row_mapping = |movie: &AddMovieSearchResult| {
|
||||
@@ -260,7 +266,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.radarr_data
|
||||
.add_searched_movies
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_movies must be populated")
|
||||
.current_selection()
|
||||
.title
|
||||
.text,
|
||||
@@ -269,7 +275,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.radarr_data
|
||||
.add_searched_movies
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_movies must be populated")
|
||||
.current_selection()
|
||||
.overview
|
||||
.clone(),
|
||||
@@ -287,7 +293,12 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
root_folder_list,
|
||||
tags,
|
||||
..
|
||||
} = app.data.radarr_data.add_movie_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_ref()
|
||||
.expect("add_movie_modal must exist in this context");
|
||||
|
||||
let selected_monitor = monitor_list.current_selection();
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
@@ -378,7 +389,7 @@ fn draw_add_movie_select_monitor_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.monitor_list,
|
||||
|monitor| ListItem::new(monitor.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -394,7 +405,7 @@ fn draw_add_movie_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mut
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.minimum_availability_list,
|
||||
|minimum_availability| ListItem::new(minimum_availability.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -410,7 +421,7 @@ fn draw_add_movie_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut App<
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
@@ -426,7 +437,7 @@ fn draw_add_movie_select_root_folder_popup(f: &mut Frame<'_>, app: &mut App<'_>)
|
||||
.radarr_data
|
||||
.add_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_movie_modal must exist in this context")
|
||||
.root_folder_list,
|
||||
|root_folder| ListItem::new(root_folder.path.to_owned()),
|
||||
);
|
||||
|
||||
@@ -87,7 +87,12 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
monitored,
|
||||
path,
|
||||
tags,
|
||||
} = app.data.radarr_data.edit_movie_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_ref()
|
||||
.expect("edit_movie_modal must exist in this context");
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
|
||||
@@ -175,7 +180,7 @@ fn draw_edit_movie_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mu
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_movie_modal must exist in this context")
|
||||
.minimum_availability_list,
|
||||
|minimum_availability| ListItem::new(minimum_availability.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -191,7 +196,7 @@ fn draw_edit_movie_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut App
|
||||
.radarr_data
|
||||
.edit_movie_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_movie_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
|
||||
@@ -99,7 +99,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let certification = movie.certification.clone().unwrap_or_default();
|
||||
let quality_profile = quality_profile_map
|
||||
.get_by_left(&movie.quality_profile_id)
|
||||
.unwrap()
|
||||
.expect("Quality profile ID must exist in quality_profile_map")
|
||||
.to_owned();
|
||||
let empty_tag = String::new();
|
||||
let tags = if !movie.tags.is_empty() {
|
||||
@@ -108,7 +108,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.iter()
|
||||
.map(|tag_id| {
|
||||
tags_map
|
||||
.get_by_left(&tag_id.as_i64().unwrap())
|
||||
.get_by_left(&tag_id.as_i64().expect("Tag ID must be a valid i64"))
|
||||
.unwrap_or(&empty_tag)
|
||||
.clone()
|
||||
})
|
||||
|
||||
@@ -472,7 +472,7 @@ fn draw_manual_search_confirm_prompt(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
.radarr_data
|
||||
.movie_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("movie_details_modal must exist in this context")
|
||||
.movie_releases
|
||||
.current_selection();
|
||||
let title = if current_selection.rejected {
|
||||
|
||||
@@ -80,14 +80,14 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.add_series_search
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_series_search must be populated")
|
||||
.text;
|
||||
let offset = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.add_series_search
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_series_search must be populated")
|
||||
.offset
|
||||
.load(Ordering::SeqCst);
|
||||
let search_results_row_mapping = |series: &AddSeriesSearchResult| {
|
||||
@@ -232,7 +232,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.add_searched_series
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_series must be populated")
|
||||
.current_selection()
|
||||
.title
|
||||
.text,
|
||||
@@ -241,7 +241,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.add_searched_series
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("add_searched_series must be populated")
|
||||
.current_selection()
|
||||
.overview
|
||||
.clone()
|
||||
@@ -261,7 +261,12 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
use_season_folder,
|
||||
tags,
|
||||
..
|
||||
} = app.data.sonarr_data.add_series_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_ref()
|
||||
.expect("add_series_modal must exist in this context");
|
||||
|
||||
let selected_monitor = monitor_list.current_selection();
|
||||
let selected_series_type = series_type_list.current_selection();
|
||||
@@ -367,7 +372,7 @@ fn draw_add_series_select_monitor_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_series_modal must exist in this context")
|
||||
.monitor_list,
|
||||
|monitor| ListItem::new(monitor.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -383,7 +388,7 @@ fn draw_add_series_select_series_type_popup(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_series_modal must exist in this context")
|
||||
.series_type_list,
|
||||
|series_type| ListItem::new(series_type.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -399,7 +404,7 @@ fn draw_add_series_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut App
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_series_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
@@ -415,7 +420,7 @@ fn draw_add_series_select_language_profile_popup(f: &mut Frame<'_>, app: &mut Ap
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_series_modal must exist in this context")
|
||||
.language_profile_list,
|
||||
|language_profile| ListItem::new(language_profile.clone()),
|
||||
);
|
||||
@@ -431,7 +436,7 @@ fn draw_add_series_select_root_folder_popup(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
.sonarr_data
|
||||
.add_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("add_series_modal must exist in this context")
|
||||
.root_folder_list,
|
||||
|root_folder| ListItem::new(root_folder.path.to_owned()),
|
||||
);
|
||||
|
||||
@@ -99,7 +99,12 @@ fn draw_edit_series_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, ar
|
||||
use_season_folders,
|
||||
path,
|
||||
tags,
|
||||
} = app.data.sonarr_data.edit_series_modal.as_ref().unwrap();
|
||||
} = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.edit_series_modal
|
||||
.as_ref()
|
||||
.expect("edit_series_modal must exist in this context");
|
||||
let selected_series_type = series_type_list.current_selection();
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
let selected_language_profile = language_profile_list.current_selection();
|
||||
@@ -202,7 +207,7 @@ fn draw_edit_series_select_series_type_popup(f: &mut Frame<'_>, app: &mut App<'_
|
||||
.sonarr_data
|
||||
.edit_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_series_modal must exist in this context")
|
||||
.series_type_list,
|
||||
|series_type| ListItem::new(series_type.to_display_str().to_owned()),
|
||||
);
|
||||
@@ -218,7 +223,7 @@ fn draw_edit_series_select_quality_profile_popup(f: &mut Frame<'_>, app: &mut Ap
|
||||
.sonarr_data
|
||||
.edit_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_series_modal must exist in this context")
|
||||
.quality_profile_list,
|
||||
|quality_profile| ListItem::new(quality_profile.clone()),
|
||||
);
|
||||
@@ -234,7 +239,7 @@ fn draw_edit_series_select_language_profile_popup(f: &mut Frame<'_>, app: &mut A
|
||||
.sonarr_data
|
||||
.edit_series_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("edit_series_modal must exist in this context")
|
||||
.language_profile_list,
|
||||
|language_profile| ListItem::new(language_profile.clone()),
|
||||
);
|
||||
|
||||
@@ -60,10 +60,10 @@ impl DrawUi for EpisodeDetailsUi {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("episode_details_modal must exist in this context")
|
||||
.episode_details_tabs,
|
||||
);
|
||||
draw_episode_details_tabs(f, app, content_area);
|
||||
@@ -77,7 +77,7 @@ impl DrawUi for EpisodeDetailsUi {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episodes
|
||||
.current_selection()
|
||||
.title
|
||||
@@ -181,7 +181,7 @@ fn draw_episode_details(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.is_none(),
|
||||
block,
|
||||
@@ -303,10 +303,10 @@ fn draw_episode_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("episode_details_modal must exist in this context")
|
||||
.episode_history;
|
||||
let history_table =
|
||||
ManagarrTable::new(Some(&mut episode_history_table), history_row_mapping)
|
||||
@@ -332,7 +332,7 @@ fn draw_episode_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.is_none(),
|
||||
layout_block_top_border(),
|
||||
@@ -474,10 +474,10 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("episode_details_modal must exist in this context")
|
||||
.episode_releases;
|
||||
let release_table = ManagarrTable::new(
|
||||
Some(&mut episode_release_table),
|
||||
@@ -513,7 +513,7 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.is_none(),
|
||||
layout_block_top_border(),
|
||||
@@ -529,10 +529,10 @@ fn draw_manual_episode_search_confirm_prompt(f: &mut Frame<'_>, app: &mut App<'_
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episode_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("episode_details_modal must exist in this context")
|
||||
.episode_releases
|
||||
.current_selection();
|
||||
let title = if current_selection.rejected {
|
||||
|
||||
@@ -106,11 +106,11 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.map_or(0f64, |stats| convert_to_gb(stats.size_on_disk));
|
||||
let quality_profile = quality_profile_map
|
||||
.get_by_left(&series.quality_profile_id)
|
||||
.unwrap()
|
||||
.expect("Quality profile ID must exist in quality_profile_map")
|
||||
.to_owned();
|
||||
let language_profile = language_profile_map
|
||||
.get_by_left(&series.language_profile_id)
|
||||
.unwrap()
|
||||
.expect("Language profile ID must exist in language_profile_map")
|
||||
.to_owned();
|
||||
let empty_tag = String::new();
|
||||
let tags = if !series.tags.is_empty() {
|
||||
@@ -119,7 +119,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.iter()
|
||||
.map(|tag_id| {
|
||||
tags_map
|
||||
.get_by_left(&tag_id.as_i64().unwrap())
|
||||
.get_by_left(&tag_id.as_i64().expect("Tag ID must be a valid i64"))
|
||||
.unwrap_or(&empty_tag)
|
||||
.clone()
|
||||
})
|
||||
|
||||
@@ -67,7 +67,7 @@ impl DrawUi for SeasonDetailsUi {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.season_details_tabs,
|
||||
);
|
||||
draw_season_details(f, app, content_area);
|
||||
@@ -103,7 +103,7 @@ impl DrawUi for SeasonDetailsUi {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.episodes
|
||||
.current_selection()
|
||||
.title
|
||||
@@ -294,7 +294,7 @@ fn draw_season_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.season_history;
|
||||
let history_table =
|
||||
ManagarrTable::new(Some(&mut season_history_table), history_row_mapping)
|
||||
@@ -426,7 +426,7 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_mut()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.season_releases;
|
||||
let release_table =
|
||||
ManagarrTable::new(Some(&mut season_release_table), season_release_row_mapping)
|
||||
@@ -467,7 +467,7 @@ fn draw_manual_season_search_confirm_prompt(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.expect("season_details_modal must exist in this context")
|
||||
.season_releases
|
||||
.current_selection();
|
||||
let title = if current_selection.rejected {
|
||||
|
||||
@@ -333,7 +333,12 @@ fn draw_series_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
])
|
||||
.primary()
|
||||
};
|
||||
let mut series_history_table = app.data.sonarr_data.series_history.as_mut().unwrap();
|
||||
let mut series_history_table = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.series_history
|
||||
.as_mut()
|
||||
.expect("series_history must be populated");
|
||||
let history_table =
|
||||
ManagarrTable::new(Some(&mut series_history_table), history_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
|
||||
+160
-16
@@ -40,31 +40,94 @@ where
|
||||
}
|
||||
|
||||
fn awaiting_import(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().awaiting_import.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.awaiting_import
|
||||
.expect("awaiting_import style must be defined in theme")
|
||||
.color
|
||||
.expect("awaiting_import color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn indeterminate(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().indeterminate.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.indeterminate
|
||||
.expect("indeterminate style must be defined in theme")
|
||||
.color
|
||||
.expect("indeterminate color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn default(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().default.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.default
|
||||
.expect("default style must be defined in theme")
|
||||
.color
|
||||
.expect("default color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn downloaded(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().downloaded.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.downloaded
|
||||
.expect("downloaded style must be defined in theme")
|
||||
.color
|
||||
.expect("downloaded color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn downloading(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().downloading.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.downloading
|
||||
.expect("downloading style must be defined in theme")
|
||||
.color
|
||||
.expect("downloading color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn failure(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().failure.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.failure
|
||||
.expect("failure style must be defined in theme")
|
||||
.color
|
||||
.expect("failure color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn help(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().help.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.help
|
||||
.expect("help style must be defined in theme")
|
||||
.color
|
||||
.expect("help color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn highlight(self) -> T {
|
||||
@@ -72,38 +135,119 @@ where
|
||||
}
|
||||
|
||||
fn missing(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().missing.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.missing
|
||||
.expect("missing style must be defined in theme")
|
||||
.color
|
||||
.expect("missing color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn primary(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().primary.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.primary
|
||||
.expect("primary style must be defined in theme")
|
||||
.color
|
||||
.expect("primary color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn secondary(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().secondary.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.secondary
|
||||
.expect("secondary style must be defined in theme")
|
||||
.color
|
||||
.expect("secondary color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn success(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().success.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.success
|
||||
.expect("success style must be defined in theme")
|
||||
.color
|
||||
.expect("success color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn system_function(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().system_function.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.system_function
|
||||
.expect("system_function style must be defined in theme")
|
||||
.color
|
||||
.expect("system_function color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn unmonitored(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().unmonitored.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.unmonitored
|
||||
.expect("unmonitored style must be defined in theme")
|
||||
.color
|
||||
.expect("unmonitored color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn unmonitored_missing(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().unmonitored_missing.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.unmonitored_missing
|
||||
.expect("unmonitored_missing style must be defined in theme")
|
||||
.color
|
||||
.expect("unmonitored_missing color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn unreleased(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().unreleased.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.unreleased
|
||||
.expect("unreleased style must be defined in theme")
|
||||
.color
|
||||
.expect("unreleased color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
fn warning(self) -> T {
|
||||
THEME.with(|theme| self.fg(theme.get().warning.unwrap().color.unwrap()))
|
||||
THEME.with(|theme| {
|
||||
self.fg(
|
||||
theme
|
||||
.get()
|
||||
.warning
|
||||
.expect("warning style must be defined in theme")
|
||||
.color
|
||||
.expect("warning color must be defined"),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user