aboutsummaryrefslogtreecommitdiff
path: root/tool/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tool/src/main.rs')
-rw-r--r--tool/src/main.rs50
1 files changed, 6 insertions, 44 deletions
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 <metamuffin.org>
*/
-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<String>,
- #[arg(short, long)]
- media: Option<PathBuf>,
- #[arg(short, long)]
- library_path: Option<PathBuf>,
- },
- Migrate {
- database: PathBuf,
- mode: MigrateMode,
- save_location: PathBuf,
- },
- Reimport {
- /// Custom hostname, the config's is used by default
- #[arg(long)]
- hostname: Option<String>,
- /// 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()