added config
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -1,3 +1,5 @@
|
||||
mod core;
|
||||
|
||||
use std::{
|
||||
io,
|
||||
time::{Duration, Instant},
|
||||
@@ -26,6 +28,7 @@ enum View {
|
||||
struct App {
|
||||
should_exit: bool,
|
||||
status: String,
|
||||
config_status: String,
|
||||
|
||||
view_stack: Vec<View>,
|
||||
|
||||
@@ -35,11 +38,16 @@ struct App {
|
||||
|
||||
impl Default for App {
|
||||
fn default() -> Self {
|
||||
let config_status = match core::config::load_config() {
|
||||
Ok(cfg) => format!("config: ok ({})", cfg.base_url),
|
||||
Err(e) => format!("config: missing/invalid ({:?})", e),
|
||||
};
|
||||
|
||||
Self {
|
||||
should_exit: false,
|
||||
status: "Press q to quit".to_string(),
|
||||
config_status,
|
||||
view_stack: vec![View::Categories],
|
||||
|
||||
items: vec![
|
||||
"Shows".into(),
|
||||
"Movies".into(),
|
||||
@@ -178,7 +186,8 @@ fn ui(frame: &mut Frame, app: &App) {
|
||||
panes.left_output,
|
||||
);
|
||||
frame.render_widget(
|
||||
Block::bordered().title("Info").merge_borders(MergeStrategy::Exact),
|
||||
Paragraph::new(app.config_status.as_str())
|
||||
.block(Block::bordered().title("Info").merge_borders(MergeStrategy::Exact)),
|
||||
panes.right_output,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user