use std::path::PathBuf;
use argh::FromArgs;
use crate::upload::LitterExpiry;
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
pub struct Cli {
#[argh(subcommand)]
pub command: CliSubCommands,
#[argh(switch, short = 'j')]
pub json: bool,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand)]
pub enum CliSubCommands {
File(FileCommand),
Album(AlbumCommand),
Config(ConfigCommand),
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "config")]
pub struct ConfigCommand {
#[argh(subcommand)]
pub command: ConfigSubCommands,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand)]
pub enum ConfigSubCommands {
Save(SaveConfig),
Delete(DeleteConfig),
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "delete")]
pub struct DeleteConfig {}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "save")]
pub struct SaveConfig {
#[argh(option)]
pub username: String,
#[argh(option)]
pub password: String,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "file")]
pub struct FileCommand {
#[argh(subcommand)]
pub command: FileSubCommands,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand)]
pub enum FileSubCommands {
Upload(FileUpload),
List(FileList),
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "list")]
pub struct FileList {}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "upload")]
pub struct FileUpload {
#[argh(switch)]
pub use_litterbox: bool,
#[argh(option)]
pub expiry: Option<LitterExpiry>,
#[argh(positional)]
pub paths: Vec<PathBuf>,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "album")]
pub struct AlbumCommand {
#[argh(subcommand)]
pub command: AlbumSubCommands,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand)]
pub enum AlbumSubCommands {
List(AlbumList),
Add(AddFiles),
Upload(UploadFiles),
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "add")]
pub struct AddFiles {
#[argh(option)]
pub album: String,
#[argh(positional)]
pub files: Vec<String>,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "upload")]
pub struct UploadFiles {
#[argh(option)]
pub album: String,
#[argh(positional)]
pub files: Vec<PathBuf>,
}
#[derive(FromArgs, PartialEq, Eq, Debug, Clone)]
#[argh(subcommand, name = "list")]
pub struct AlbumList {
#[argh(option)]
pub album: Option<String>,
}