init
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
mod bark;
|
||||
mod nettool;
|
||||
mod archive;
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "toolbox", version, about = "多功能集成运维 CLI 工具")]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
enum Commands {
|
||||
/// 发送 Bark 推送通知
|
||||
Bark(bark::BarkArgs),
|
||||
/// 网络运维诊断工具
|
||||
Nettool(nettool::NetToolArgs),
|
||||
/// 文件归档与解压工具
|
||||
Archive(archive::ArchiveArgs),
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
Commands::Bark(args) => {
|
||||
bark::run(args).await?;
|
||||
}
|
||||
Commands::Nettool(args) => {
|
||||
nettool::run(args).await?;
|
||||
}
|
||||
Commands::Archive(args) => {
|
||||
archive::run(args).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user