aboutsummaryrefslogtreecommitdiff
path: root/tool/src/cli.rs
blob: b51b135fb93335130b689e9cf7c013f09edf2e51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use clap::{arg, Parser, ValueEnum};
use std::path::PathBuf;

pub type Args = Action;

#[derive(Parser)]
#[clap(version, about)]
/// Tool for administering a Jellything instance
pub enum Action {
    /// Interactive wizard for renaming files
    Add {
        /// Path to the media of this node.
        media: PathBuf,
    },
    /// Migrate the database by export or import to JSON
    Migrate {
        /// Database path as specified in the configuration
        database: PathBuf,
        /// Whether to import or export
        mode: MigrateMode,
        /// Location of the database in its exported form
        save_location: PathBuf,
    },
    /// Issue a reimport via the API
    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)]
pub enum MigrateMode {
    /// Import from JSON
    Import,
    /// Export to JSON
    Export,
}