49 lines
1.2 KiB
Rust
49 lines
1.2 KiB
Rust
|
|
use std::path::PathBuf;
|
||
|
|
|
||
|
|
use clap::{Parser, builder::PossibleValuesParser};
|
||
|
|
|
||
|
|
#[derive(Parser, Debug, Hash)]
|
||
|
|
#[command(version, about, long_about = None)]
|
||
|
|
pub struct Cli {
|
||
|
|
/// Timeout in seconds for HTTP actions
|
||
|
|
#[arg(short, long)]
|
||
|
|
pub timeout: Option<u64>,
|
||
|
|
|
||
|
|
/// Protocol for Sharry instance
|
||
|
|
#[arg(
|
||
|
|
short, long,
|
||
|
|
default_value_t = String::from("https"),
|
||
|
|
value_parser = PossibleValuesParser::new(["http", "https"]),
|
||
|
|
)]
|
||
|
|
pub proto: String,
|
||
|
|
|
||
|
|
/// Name of the new share
|
||
|
|
#[arg(
|
||
|
|
short, long,
|
||
|
|
default_value_t = String::from("shrupl upload"),
|
||
|
|
)]
|
||
|
|
pub name: String,
|
||
|
|
|
||
|
|
/// Description of the new share
|
||
|
|
#[arg(short, long)]
|
||
|
|
pub desc: Option<String>,
|
||
|
|
|
||
|
|
/// Maximum number of views for the new share
|
||
|
|
#[arg(short, long, default_value_t = 10)]
|
||
|
|
pub views: u32,
|
||
|
|
|
||
|
|
/// Chunk size for uploading, in MiB
|
||
|
|
#[arg(short, long, default_value_t = 10)]
|
||
|
|
pub chunk: usize,
|
||
|
|
|
||
|
|
/// Base URL for Sharry Instance
|
||
|
|
pub url: String,
|
||
|
|
|
||
|
|
/// ID of a public alias to use
|
||
|
|
pub alias: String,
|
||
|
|
|
||
|
|
/// Files to upload to the new share
|
||
|
|
#[arg(value_name = "FILE")]
|
||
|
|
pub files: Vec<PathBuf>,
|
||
|
|
}
|