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, Debug)]
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 /// Whether to skip the confirmation prompt before deletion.
29 ///
30 /// Set via `--yes` / `-y`. CLI-only; not configurable via TOML.
31 pub yes: bool,
32}
33
34#[cfg(test)]
35mod tests {
36 use super::*;
37
38 #[test]
39 fn test_execution_options_creation() {
40 let exec_opts = ExecutionOptions {
41 dry_run: true,
42 interactive: false,
43 keep_executables: false,
44 use_trash: false,
45 yes: false,
46 };
47
48 assert!(exec_opts.dry_run);
49 assert!(!exec_opts.interactive);
50 assert!(!exec_opts.keep_executables);
51 assert!(!exec_opts.use_trash);
52 }
53
54 #[test]
55 fn test_execution_options_clone() {
56 let original = ExecutionOptions {
57 dry_run: true,
58 interactive: false,
59 keep_executables: true,
60 use_trash: true,
61 yes: false,
62 };
63 let cloned = original.clone();
64
65 assert_eq!(original.dry_run, cloned.dry_run);
66 assert_eq!(original.interactive, cloned.interactive);
67 assert_eq!(original.keep_executables, cloned.keep_executables);
68 assert_eq!(original.use_trash, cloned.use_trash);
69 }
70}