feat: add jello-types crate and update dependencies with backtrace support
This commit is contained in:
66
src/cli.rs
66
src/cli.rs
@@ -1,36 +1,38 @@
|
||||
#[derive(Debug, clap::Parser)]
|
||||
pub struct Cli {
|
||||
#[clap(subcommand)]
|
||||
pub cmd: SubCommand,
|
||||
// #[clap(subcommand)]
|
||||
// pub cmd: SubCommand,
|
||||
#[command(flatten)]
|
||||
pub verbosity: clap_verbosity_flag::Verbosity,
|
||||
}
|
||||
|
||||
#[derive(Debug, clap::Subcommand)]
|
||||
pub enum SubCommand {
|
||||
#[clap(name = "add")]
|
||||
Add(Add),
|
||||
#[clap(name = "list")]
|
||||
List(List),
|
||||
#[clap(name = "completions")]
|
||||
Completions { shell: clap_complete::Shell },
|
||||
}
|
||||
|
||||
#[derive(Debug, clap::Args)]
|
||||
pub struct Add {
|
||||
#[clap(short, long)]
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, clap::Args)]
|
||||
pub struct List {}
|
||||
|
||||
impl Cli {
|
||||
pub fn completions(shell: clap_complete::Shell) {
|
||||
let mut command = <Cli as clap::CommandFactory>::command();
|
||||
clap_complete::generate(
|
||||
shell,
|
||||
&mut command,
|
||||
env!("CARGO_BIN_NAME"),
|
||||
&mut std::io::stdout(),
|
||||
);
|
||||
}
|
||||
}
|
||||
// #[derive(Debug, clap::Subcommand)]
|
||||
// pub enum SubCommand {
|
||||
// #[clap(name = "add")]
|
||||
// Add(Add),
|
||||
// #[clap(name = "list")]
|
||||
// List(List),
|
||||
// #[clap(name = "completions")]
|
||||
// Completions { shell: clap_complete::Shell },
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug, clap::Args)]
|
||||
// pub struct Add {
|
||||
// #[clap(short, long)]
|
||||
// pub name: String,
|
||||
// }
|
||||
//
|
||||
// #[derive(Debug, clap::Args)]
|
||||
// pub struct List {}
|
||||
//
|
||||
// impl Cli {
|
||||
// pub fn completions(shell: clap_complete::Shell) {
|
||||
// let mut command = <Cli as clap::CommandFactory>::command();
|
||||
// clap_complete::generate(
|
||||
// shell,
|
||||
// &mut command,
|
||||
// env!("CARGO_BIN_NAME"),
|
||||
// &mut std::io::stdout(),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
mod cli;
|
||||
mod errors;
|
||||
use api::JellyfinConfig;
|
||||
use errors::*;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
color_backtrace::install();
|
||||
let args = <cli::Cli as clap::Parser>::parse();
|
||||
tracing_subscriber::fmt()
|
||||
.with_max_level(args.verbosity)
|
||||
.init();
|
||||
ui_iced::ui().change_context(Error)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user