From 1e9c97c21f8a4e55420712b054895ff8b4f9a849 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 19 Jun 2026 01:40:38 +0800 Subject: feat(rola-bucket): add bucket bind management Implement bucket bind CRUD operations and config loading, along with CLI integration for listing, setting, and removing bucket bindings. --- rola-cli/src/res/bucket.rs | 25 +++++++++++++++++++++++++ rola-cli/src/res/overwrite.rs | 9 +++++++++ 2 files changed, 34 insertions(+) create mode 100644 rola-cli/src/res/bucket.rs create mode 100644 rola-cli/src/res/overwrite.rs (limited to 'rola-cli/src/res') diff --git a/rola-cli/src/res/bucket.rs b/rola-cli/src/res/bucket.rs new file mode 100644 index 0000000..16b8fc9 --- /dev/null +++ b/rola-cli/src/res/bucket.rs @@ -0,0 +1,25 @@ +use std::env::current_dir; + +use rorolala::bucket::{Bucket, NoProtocol}; +use space_system::Space; + +/// A resource holding a local filesystem bucket without a protocol. +/// +/// This struct wraps a [`Space>`] that provides access to a +/// local filesystem bucket. It automatically initializes the bucket's current +/// directory from the [`ResCurrentDir`] resource injected into [`ThisProgram`]. +#[derive(Clone)] +pub struct ResBucketWithoutProtocol { + /// The space containing the protocol-less local bucket. + pub space: Space>, +} + +impl Default for ResBucketWithoutProtocol { + fn default() -> Self { + let current_dir = current_dir().unwrap(); + let mut space = Space::new(Bucket::::new_local()); + space.set_current_dir(current_dir).unwrap(); + + Self { space } + } +} diff --git a/rola-cli/src/res/overwrite.rs b/rola-cli/src/res/overwrite.rs new file mode 100644 index 0000000..cef0932 --- /dev/null +++ b/rola-cli/src/res/overwrite.rs @@ -0,0 +1,9 @@ +/// A flag indicating whether to overwrite existing resources. +/// +/// This struct encapsulates a boolean value that indicates whether to overwrite +/// existing files or data during resource processing. +#[derive(Debug, Default, Clone)] +pub struct ResOverwrite { + /// Boolean flag, `true` means overwrite is allowed, `false` means it is not. + pub overwrite: bool, +} -- cgit