aviary-cli/src/parse.rs

71 lines
1.7 KiB
Rust

use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Clone, Debug, Parser)]
#[clap(name = "aviary")]
/// Create and download E2E encrypted image galleries
pub struct Args {
/// The null pointer server to use
#[clap(long, short, default_value = "0x0.corviform.gay")]
pub server: String,
#[clap(subcommand)]
pub command: Command,
}
#[derive(Clone, Debug, Subcommand)]
pub enum Command {
Create(CreateArgs),
Download(DownloadArgs),
}
#[derive(Clone, Debug, Parser)]
/// Upload a series of images to a new gallery
pub struct CreateArgs {
/// The title of the gallery
#[clap(long, short)]
pub title: Option<String>,
/// A list of image files to post
#[clap(required = true, min_values = 1)]
pub images: Vec<PathBuf>,
}
#[derive(Clone, Debug, Parser)]
/// Download a gallery
pub struct DownloadArgs {
/// The file id
///
/// This is a short series of characters that identifies the file
/// For the url:
///
/// https://0x0.st/asdj.bin#omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
///
/// the file id is asdj
#[clap(required = true)]
pub id: String,
/// The encryption key
///
/// This is the text after the # sign which is the secret for decrypting the pictures.
/// For the url:
///
/// https://0x0.st/asdj.bin#omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
///
/// the encryption key is omONdEzrY6SfdBgHn/2P6yG33PeIhuj3/SGm/lDhd2U=
#[clap(required = true)]
pub key: String,
/// The directory to put the new files into
///
/// A directory will be generated based on the name of the gallery if this is not set
#[clap(long, short)]
pub output: Option<PathBuf>,
/// Overwrite any existing files in the output directory
#[clap(long, short)]
pub force: bool,
}