aviary-cli/src/parse.rs

71 lines
1.7 KiB
Rust
Raw Normal View History

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