Lidarr support #1
+21
-8
@@ -3,12 +3,15 @@
|
|||||||
extern crate assertables;
|
extern crate assertables;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use clap::{CommandFactory, Parser, crate_authors, crate_description, crate_name, crate_version};
|
use clap::{
|
||||||
|
Args, CommandFactory, Parser, crate_authors, crate_description, crate_name, crate_version,
|
||||||
|
};
|
||||||
use clap_complete::generate;
|
use clap_complete::generate;
|
||||||
use crossterm::execute;
|
use crossterm::execute;
|
||||||
use crossterm::terminal::{
|
use crossterm::terminal::{
|
||||||
EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode,
|
EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode,
|
||||||
};
|
};
|
||||||
|
use indoc::indoc;
|
||||||
use log::{debug, error, warn};
|
use log::{debug, error, warn};
|
||||||
use network::NetworkTrait;
|
use network::NetworkTrait;
|
||||||
use ratatui::Terminal;
|
use ratatui::Terminal;
|
||||||
@@ -64,6 +67,13 @@ mod utils;
|
|||||||
struct Cli {
|
struct Cli {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Option<Command>,
|
command: Option<Command>,
|
||||||
|
#[command(flatten)]
|
||||||
|
global: GlobalOpts,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Args, Debug)]
|
||||||
|
#[command(next_help_heading = "Global Options")]
|
||||||
|
struct GlobalOpts {
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
global = true,
|
global = true,
|
||||||
@@ -98,9 +108,12 @@ struct Cli {
|
|||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
global = true,
|
global = true,
|
||||||
help = "For multi-instance configurations, you need to specify the name of the instance configuration that you want to use.
|
help = indoc!{"
|
||||||
This is useful when you have multiple instances of the same Servarr defined in your config file.
|
For multi-instance configurations, you need to specify the name of the instance configuration that you want to use.
|
||||||
By default, if left empty, the first configured Servarr instance listed in the config file will be used."
|
|
||||||
|
This is useful when you have multiple instances of the same Servarr defined in your config file.
|
||||||
|
By default, if left empty, the first configured Servarr instance listed in the config file will be used.
|
||||||
|
"}
|
||||||
)]
|
)]
|
||||||
servarr_name: Option<String>,
|
servarr_name: Option<String>,
|
||||||
}
|
}
|
||||||
@@ -114,13 +127,13 @@ async fn main() -> Result<()> {
|
|||||||
let running = Arc::new(AtomicBool::new(true));
|
let running = Arc::new(AtomicBool::new(true));
|
||||||
let r = running.clone();
|
let r = running.clone();
|
||||||
let args = Cli::parse();
|
let args = Cli::parse();
|
||||||
let mut config = if let Some(ref config_file) = args.config_file {
|
let mut config = if let Some(ref config_file) = args.global.config_file {
|
||||||
load_config(config_file.to_str().expect("Invalid config file specified"))?
|
load_config(config_file.to_str().expect("Invalid config file specified"))?
|
||||||
} else {
|
} else {
|
||||||
confy::load("managarr", "config")?
|
confy::load("managarr", "config")?
|
||||||
};
|
};
|
||||||
let theme_name = config.theme.clone();
|
let theme_name = config.theme.clone();
|
||||||
let spinner_disabled = args.disable_spinner;
|
let spinner_disabled = args.global.disable_spinner;
|
||||||
debug!("Managarr loaded using config: {config:?}");
|
debug!("Managarr loaded using config: {config:?}");
|
||||||
config.validate();
|
config.validate();
|
||||||
config.post_process_initialization();
|
config.post_process_initialization();
|
||||||
@@ -165,8 +178,8 @@ async fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
start_ui(
|
start_ui(
|
||||||
&app,
|
&app,
|
||||||
&args.themes_file,
|
&args.global.themes_file,
|
||||||
args.theme.unwrap_or(theme_name.unwrap_or_default()),
|
args.global.theme.unwrap_or(theme_name.unwrap_or_default()),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user