From ddf52f02d66abfee17a4105503220a9a34064f29 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 16 Apr 2024 18:15:47 +0200 Subject: jellytool completion generator --- tool/src/main.rs | 50 ++++++-------------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) (limited to 'tool/src/main.rs') diff --git a/tool/src/main.rs b/tool/src/main.rs index d2518e8..a896fa2 100644 --- a/tool/src/main.rs +++ b/tool/src/main.rs @@ -4,55 +4,17 @@ Copyright (C) 2024 metamuffin */ -pub mod add; -pub mod migrate; - -use add::add; use anyhow::anyhow; -use clap::{Parser, Subcommand, ValueEnum}; +use clap::Parser; use jellybase::{CONF, SECRETS}; use jellyclient::Instance; use jellycommon::user::CreateSessionParams; +use jellytool::{ + add::add, + cli::{Action, Args}, + migrate::migrate, +}; use log::info; -use migrate::migrate; -use std::{fmt::Debug, path::PathBuf}; - -#[derive(Parser)] -struct Args { - #[clap(subcommand)] - action: Action, -} - -#[derive(Subcommand)] -enum Action { - Add { - #[arg(short, long)] - id: Option, - #[arg(short, long)] - media: Option, - #[arg(short, long)] - library_path: Option, - }, - Migrate { - database: PathBuf, - mode: MigrateMode, - save_location: PathBuf, - }, - Reimport { - /// Custom hostname, the config's is used by default - #[arg(long)] - hostname: Option, - /// Disable TLS. Dont use this. - #[arg(long)] - no_tls: bool, - }, -} - -#[derive(Debug, Clone, Copy, PartialEq, ValueEnum)] -enum MigrateMode { - Import, - Export, -} fn main() -> anyhow::Result<()> { env_logger::builder() -- cgit v1.2.3-70-g09d2