reactive_graph/tooling/releases/
args.rs

1use crate::shared::output_format::OutputFormatArgsOptional;
2use clap::ArgAction;
3use clap::Parser;
4
5#[derive(Parser, Debug)]
6#[clap(disable_version_flag = true)]
7pub struct ReleaseArgs {
8    /// Selects the nightly release.
9    #[clap(group = "release_tag", short = 'n', long, action=ArgAction::SetTrue, conflicts_with_all = ["latest", "current", "version"])]
10    pub nightly: Option<bool>,
11
12    /// Selects the latest release.
13    /// Currently, the latest release is the nightly release. This will change in the future.
14    #[clap(group = "release_tag", short = 'l', long, action=ArgAction::SetTrue, conflicts_with_all = ["nightly", "current", "version"])]
15    pub latest: Option<bool>,
16
17    /// Selects the current release.
18    #[clap(group = "release_tag", short = 'c', long, action=ArgAction::SetTrue, conflicts_with_all = ["nightly", "latest", "version"])]
19    pub current: Option<bool>,
20
21    /// Selects a specific version.
22    #[clap(group = "release_tag", short = 'v', long, conflicts_with_all = ["nightly", "latest", "current"])]
23    pub version: Option<String>,
24
25    /// Hides the download progress.
26    #[clap(long, action=ArgAction::SetTrue)]
27    pub hide_download_progress: Option<bool>,
28
29    /// Hides the output.
30    #[clap(long, action=ArgAction::SetTrue)]
31    pub hide_output: Option<bool>,
32
33    /// Hides the download progress and the output.
34    #[clap(short = 'q', long, action=ArgAction::SetTrue)]
35    pub quiet: Option<bool>,
36
37    /// Don't ask.
38    #[clap(short = 'y', long, action=ArgAction::SetTrue)]
39    pub no_confirm: Option<bool>,
40}
41
42impl ReleaseArgs {
43    pub fn show_download_progress(&self) -> bool {
44        !(self.hide_download_progress.unwrap_or_default() || self.quiet.unwrap_or_default())
45    }
46
47    pub fn show_output(&self) -> bool {
48        !(self.hide_output.unwrap_or_default() || self.quiet.unwrap_or_default())
49    }
50
51    pub fn no_confirm(&self) -> bool {
52        self.no_confirm.unwrap_or_default()
53    }
54}
55
56#[derive(Parser, Debug)]
57pub struct ReleaseInfoArgs {
58    #[clap(flatten)]
59    pub output_format: OutputFormatArgsOptional,
60}
61
62#[derive(Parser, Debug)]
63pub struct ReleaseListArgs {
64    #[clap(flatten)]
65    pub output_format: OutputFormatArgsOptional,
66}