Skip to main content

trash_cli_core/
lib.rs

1//! Shared Rust foundation for trash-cli command migration.
2//! This crate intentionally stays dependency-light and focuses on stable,
3//! reusable primitives that can be consumed by command-specific crates.
4
5pub mod errors;
6pub mod fs;
7pub mod helpers;
8pub mod models;
9
10pub use errors::{CoreError, Result};
11pub use fs::{FileSystem, RealFileSystem};
12pub use helpers::{
13    build_unique_basename,
14    parse_trash_datetime,
15    print_size,
16    sanitize_user_path,
17    serialize_system_time,
18    TRASHINFO_EXTENSION,
19    TRASHINFO_TIME_FORMAT,
20};
21pub use models::{
22    CommandContext,
23    CommandKind,
24    CommandOutcome,
25    CommandOutput,
26    ExitStatusLike,
27    SkipReason,
28    TrashCommand,
29    TrashDirectory,
30    TrashedItem,
31};
32
33/// Re-export a small stable API surface for command crates.
34pub mod prelude {
35    pub use crate::errors::{CoreError, Result};
36    pub use crate::fs::{FileSystem, RealFileSystem};
37    pub use crate::helpers::{
38        build_unique_basename,
39        canonical_or_relaxed,
40        format_duration,
41        parse_trash_datetime,
42        print_size,
43        sanitize_user_path,
44        serialize_system_time,
45        TRASHINFO_EXTENSION,
46        TRASHINFO_TIME_FORMAT,
47    };
48    pub use crate::models::{
49        CommandContext,
50        CommandKind,
51        CommandOutcome,
52        CommandOutput,
53        ExitStatusLike,
54        SkipReason,
55        TrashCommand,
56        TrashDirectory,
57        TrashedItem,
58    };
59}