aviary-cli/src/parse.rs

65 lines
1.5 KiB
Rust

use std::path::PathBuf;
use argh_derive::FromArgs;
#[derive(FromArgs)]
/// Create Aviary galleries
pub struct Args {
/// the null pointer server to use
#[argh(option, short = 's', default = "\"envs.sh\".to_owned()")]
pub server: String,
#[argh(subcommand)]
pub command: Command,
}
#[derive(FromArgs)]
#[argh(subcommand)]
pub enum Command {
Create(CreateArgs),
Download(DownloadArgs),
}
#[derive(FromArgs)]
#[argh(subcommand, name = "create")]
/// upload a series of images to a new gallery
pub struct CreateArgs {
/// the title of the gallery
#[argh(option, short = 't')]
pub title: Option<String>,
/// A list of image files to post
#[argh(positional)]
pub images: Vec<String>,
}
#[derive(FromArgs)]
#[argh(subcommand, name = "download")]
/// download a gallery
pub struct DownloadArgs {
#[argh(positional)]
/// 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
pub id: String,
#[argh(positional)]
/// 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=
pub key: String,
#[argh(option, short='o')]
/// 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
pub output: Option<PathBuf>,
}