diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-03-09 19:41:50 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-03-09 19:41:50 +0800 |
| commit | 2827668ab5f38c05f95a0060988313c449436267 (patch) | |
| tree | a3b357530bb5fe704a217215b99a1ad36c43be36 /src/entry.rs | |
| parent | 5bd8a0b8e98e0dc1c8ba693c6e1530e75c62b81f (diff) | |
Move entry module into binary crate
Diffstat (limited to 'src/entry.rs')
| -rw-r--r-- | src/entry.rs | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/entry.rs b/src/entry.rs deleted file mode 100644 index f1d5203..0000000 --- a/src/entry.rs +++ /dev/null @@ -1,50 +0,0 @@ -use std::process::exit; - -use crate::chunker::{ - context::ButckContext, - rw::{self, error::ButckRWError}, -}; - -pub async fn entry(ctx: ButckContext, args: Vec<String>) -> Result<(), ButckRWError> { - if let Some(subcommand) = args.first() { - return match subcommand.as_str() { - "write" => rw::storage::write(ctx).await, - "build" => rw::storage::build(ctx).await, - "lspolicy" => { - if ctx.stream_read.is_some() { - butck_policies::stream_policies() - .iter() - .for_each(|p| println!("{}", p)); - } else { - butck_policies::policies() - .iter() - .for_each(|p| println!("{}", p)); - } - return Ok(()); - } - "lspolicy-all" => { - let policies = butck_policies::policies(); - let stream_policies = butck_policies::stream_policies(); - let mut all_policies: Vec<_> = - policies.iter().chain(stream_policies.iter()).collect(); - all_policies.sort(); - all_policies.dedup(); - all_policies.iter().for_each(|p| println!("{}", p)); - return Ok(()); - } - _ => { - print_help(); - exit(1) - } - }; - } - Ok(()) -} - -pub fn print_help() { - println!("{}", include_str!("../resources/helps/butck.txt").trim()); -} - -pub fn print_version() { - println!("{}", include_str!("../resources/version_info.txt").trim()); -} |
