Add --skip-rules flag to init command

This commit is contained in:
Jeremiah Russell
2025-10-23 10:06:41 +01:00
committed by Jeremiah Russell
parent 79e0de72e6
commit 0b24767065
2 changed files with 31 additions and 0 deletions

View File

@@ -24,6 +24,9 @@
//! //!
//! # Non-interactive setup (credential file copied manually later) //! # Non-interactive setup (credential file copied manually later)
//! cull-gmail init --config-dir ~/.cull-gmail //! cull-gmail init --config-dir ~/.cull-gmail
//!
//! # Skip rules.toml creation for ephemeral environments
//! cull-gmail init --skip-rules
//! ``` //! ```
//! //!
//! ### Planning and Verification //! ### Planning and Verification
@@ -41,6 +44,15 @@
//! cull-gmail init --force //! cull-gmail init --force
//! ``` //! ```
//! //!
//! ### Ephemeral Environments
//! ```bash
//! # Skip rules.toml creation when it's provided externally
//! cull-gmail init --skip-rules --config-dir /app/config
//!
//! # Skip rules with custom rules directory
//! cull-gmail init --skip-rules --rules-dir /mnt/rules
//! ```
//!
//! ## Security Considerations //! ## Security Considerations
//! //!
//! - **Credential Protection**: OAuth2 credential files are copied with 0600 permissions //! - **Credential Protection**: OAuth2 credential files are copied with 0600 permissions
@@ -199,6 +211,23 @@ pub struct InitCli {
help = "Prompt for missing information and confirmations" help = "Prompt for missing information and confirmations"
)] )]
pub interactive: bool, pub interactive: bool,
/// Skip rules.toml file creation.
///
/// When enabled, the rules.toml file will not be created during initialization.
/// This is useful for ephemeral compute environments where rules.toml is provided
/// externally (e.g., mounted from a volume or supplied via configuration management).
///
/// The cull-gmail.toml configuration file will still reference the rules.toml path
/// with a comment indicating that it should be provided separately.
///
/// If --rules-dir is also specified, the rules directory will be created but the
/// rules.toml file within it will not be generated.
#[arg(
long = "skip-rules",
help = "Do not create rules.toml; expect it to be provided externally"
)]
pub skip_rules: bool,
} }
/// Operations that can be performed during initialization. /// Operations that can be performed during initialization.

View File

@@ -30,6 +30,7 @@ mod unit_tests {
force: false, force: false,
dry_run: false, dry_run: false,
interactive: false, interactive: false,
skip_rules: false,
} }
} }
@@ -42,6 +43,7 @@ mod unit_tests {
force: true, force: true,
dry_run: false, dry_run: false,
interactive: false, interactive: false,
skip_rules: false,
} }
} }