diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-12 14:28:08 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-12 14:28:08 +0800 |
| commit | 0a95bae451c1847f4f0b9601e60959f4e8e6b669 (patch) | |
| tree | 9e1cfad4f86a73176a4d738b28e7732b66fe5f97 /src/cmds/cmd/storage_build.rs | |
| parent | 8564c8f2177dec0c2c0c031d156347fa6b4485bc (diff) | |
Refactor display utilities
Diffstat (limited to 'src/cmds/cmd/storage_build.rs')
| -rw-r--r-- | src/cmds/cmd/storage_build.rs | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/src/cmds/cmd/storage_build.rs b/src/cmds/cmd/storage_build.rs deleted file mode 100644 index 8e4d39c..0000000 --- a/src/cmds/cmd/storage_build.rs +++ /dev/null @@ -1,70 +0,0 @@ -use crate::{ - cmd_output, - cmds::{ - arg::storage_build::JVStorageBuildArgument, collect::empty::JVEmptyCollect, - r#in::storage_rw::JVStorageRWInput, out::none::JVNoneOutput, - }, - systems::cmd::{ - cmd_system::JVCommandContext, - errors::{CmdExecuteError, CmdPrepareError}, - }, -}; -use cli_utils::display::md; -use cmd_system_macros::exec; -use just_enough_vcs::system::storage_system::{error::StorageIOError, store::build_file}; -use rust_i18n::t; -use std::any::TypeId; - -pub struct JVStorageBuildCommand; -type Cmd = JVStorageBuildCommand; -type Arg = JVStorageBuildArgument; -type In = JVStorageRWInput; -type Collect = JVEmptyCollect; - -fn help_str() -> String { - todo!() -} - -async fn prepare(args: &Arg, _ctx: &JVCommandContext) -> Result<In, CmdPrepareError> { - let output_file = match &args.output_file { - Some(v) => v.clone(), - None => args.index_file.clone().with_extension("unknown"), - }; - - let (input, storage, output) = just_enough_vcs::system::storage_system::store::precheck( - args.index_file.clone(), - args.storage.clone(), - output_file, - ) - .await?; - - Ok(JVStorageRWInput { - input, - storage, - output, - chunking_policy: None, - }) -} - -async fn collect(_args: &Arg, _ctx: &JVCommandContext) -> Result<Collect, CmdPrepareError> { - Ok(Collect {}) -} - -#[exec] -async fn exec( - input: In, - _collect: Collect, -) -> Result<(Box<dyn std::any::Any + Send + 'static>, TypeId), CmdExecuteError> { - build_file(input.input, input.storage, input.output) - .await - .map_err(|e| match e { - StorageIOError::IOErr(error) => CmdExecuteError::Io(error), - StorageIOError::HashTooShort => { - CmdExecuteError::Error(md(t!("storage_write.hash_too_short")).to_string()) - } - })?; - - cmd_output!(JVNoneOutput => JVNoneOutput {}) -} - -crate::command_template!(); |
