Skip to main content

cleansys_core/
lib.rs

1//! # cleansys-core
2//!
3//! Shared, framework-free logic reused by both the `cleansys-tui` (Ratatui)
4//! and `cleansys-gui` (Iced) front-ends of CleanSys.
5//!
6//! | Module | What lives here |
7//! |--------|-----------------|
8//! | [`cleaners`] | System- and user-level cleaner implementations |
9//! | [`model`] | UI-agnostic domain model (`CleanerItem`, `CleanerCategory`, `Status`) |
10//! | [`auth`] | Sudo/root authentication helpers |
11//! | [`utils`] | Permission checks, formatting, confirmation prompts |
12//!
13//! This crate has NO TUI or GUI dependencies.
14
15#![allow(missing_docs)]
16
17/// Authentication helpers (sudo elevation) shared by all front-ends.
18pub mod auth;
19
20/// Cleaner implementations for system and user-level cleanup operations.
21pub mod cleaners;
22
23/// Framework-agnostic domain model (cleaner items, categories, run status).
24pub mod model;
25
26/// Persisted user preferences (theme, etc.), shared by the TUI and GUI.
27pub mod settings;
28
29/// Platform-agnostic UI theme presets, shared by the TUI and GUI.
30pub mod theme;
31
32/// Utility functions for permissions, formatting, and error handling.
33pub mod utils;
34
35// Convenience re-exports
36pub use auth::authenticate_sudo;
37pub use cleaners::cleaned_item::{
38    CleanedItem, CleanedItemType, CleanerFn, CleaningResult, RunOptions,
39};
40pub use cleaners::{system_cleaners, user_cleaners};
41pub use model::{load_categories, CleanerCategory, CleanerItem, Status};
42pub use settings::{load_settings, save_settings, Settings};
43pub use theme::{theme_by_index, theme_index_by_name, AppTheme, Rgb, THEME_COUNT, THEME_NAMES};
44pub use utils::{check_root, confirm, format_size, get_size, print_error, print_header};