Skip to main content

ready_set_rust/
options.rs

1//! Argument parsing for Rust provider lifecycle requests.
2
3use std::ffi::OsString;
4
5use clap::Parser;
6
7/// Shared setup options for `__set`.
8#[derive(Debug, Clone, Parser)]
9#[command(name = "ready-set-rust __set", about, long_about = None, no_binary_name = true)]
10#[allow(clippy::struct_excessive_bools)]
11pub struct SetOptions {
12    /// Replace files even if their content has diverged from the template.
13    #[arg(long)]
14    pub force: bool,
15
16    /// Plan and report writes without modifying any files.
17    #[arg(long)]
18    pub dry_run: bool,
19
20    /// Explicit member path to add to `[workspace.members]`. Repeatable.
21    #[arg(long = "member")]
22    pub members: Vec<String>,
23
24    /// Skip recursive crate discovery.
25    #[arg(long)]
26    pub no_discover: bool,
27}
28
29impl SetOptions {
30    /// Parse from provider passthrough args.
31    ///
32    /// # Errors
33    ///
34    /// Returns a clap error formatted for direct printing.
35    pub fn parse_args(args: &[OsString]) -> Result<Self, clap::Error> {
36        Self::try_parse_from(args)
37    }
38}