Skip to main content

clean_dev_dirs/config/
execution.rs

1//! Execution configuration for cleanup operations.
2//!
3//! This module defines the options that control how cleanup operations are executed,
4//! including dry-run mode and interactive selection.
5
6/// Configuration for cleanup execution behavior.
7///
8/// This struct provides a simplified interface to execution-related options,
9/// controlling how the cleanup process runs.
10#[derive(Clone)]
11#[allow(clippy::struct_excessive_bools)]
12pub struct ExecutionOptions {
13    /// Whether to run in dry-run mode (no actual deletion)
14    pub dry_run: bool,
15
16    /// Whether to use interactive project selection
17    pub interactive: bool,
18
19    /// Whether to preserve compiled executables before cleaning
20    pub keep_executables: bool,
21
22    /// Whether to move directories to the system trash instead of permanently deleting them.
23    ///
24    /// Defaults to `true`. Set to `false` via the `--permanent` CLI flag or
25    /// `use_trash = false` in the config file.
26    pub use_trash: bool,
27}
28
29#[cfg(test)]
30mod tests {
31    use super::*;
32
33    #[test]
34    fn test_execution_options_creation() {
35        let exec_opts = ExecutionOptions {
36            dry_run: true,
37            interactive: false,
38            keep_executables: false,
39            use_trash: false,
40        };
41
42        assert!(exec_opts.dry_run);
43        assert!(!exec_opts.interactive);
44        assert!(!exec_opts.keep_executables);
45        assert!(!exec_opts.use_trash);
46    }
47
48    #[test]
49    fn test_execution_options_clone() {
50        let original = ExecutionOptions {
51            dry_run: true,
52            interactive: false,
53            keep_executables: true,
54            use_trash: true,
55        };
56        let cloned = original.clone();
57
58        assert_eq!(original.dry_run, cloned.dry_run);
59        assert_eq!(original.interactive, cloned.interactive);
60        assert_eq!(original.keep_executables, cloned.keep_executables);
61        assert_eq!(original.use_trash, cloned.use_trash);
62    }
63}