Skip to main content

cloud_image_download/
cli.rs

1use crate::CONCURRENT_REQUESTS;
2use clap::Parser;
3
4#[derive(Parser, Debug)]
5/// This program downloads cloud image files
6/// from configured sites
7#[command(author, version, about, long_about = None)]
8#[command(propagate_version = true)]
9pub struct Cli {
10    /// Uses an alternative configuration file
11    #[arg(long, default_value = "/etc/cid.toml")]
12    pub config: String,
13
14    /// path to the database
15    pub db_path: Option<String>,
16
17    /// Maximum simultaneous downloads
18    #[arg(long, default_value_t = CONCURRENT_REQUESTS)]
19    pub concurrent_downloads: usize,
20
21    /// Forces verification of skipped downloads
22    #[arg(long, default_value_t = false)]
23    pub verify_skipped: bool,
24
25    // Verbosity level managed through clap_verbosity_flag crate
26    #[command(flatten)]
27    pub verbose: clap_verbosity_flag::Verbosity,
28}
29
30impl Cli {
31    /// Parsing the Cli and returning the structure filled accordingly
32    /// to the command line options
33    #[must_use]
34    pub fn analyze() -> Self {
35        Cli::parse()
36    }
37}