From aca8b408755f9041da9ee083c625de2a8d8c6785 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 22 Jan 2026 08:32:29 +0800 Subject: Refactor CLI command processing with new architecture --- src/subcmd/cmds/status.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/subcmd/cmds/template.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/subcmd/cmds/status.rs create mode 100644 src/subcmd/cmds/template.rs (limited to 'src/subcmd/cmds') diff --git a/src/subcmd/cmds/status.rs b/src/subcmd/cmds/status.rs new file mode 100644 index 0000000..2b92df6 --- /dev/null +++ b/src/subcmd/cmds/status.rs @@ -0,0 +1,45 @@ +use clap::Parser; +use serde::Serialize; + +use crate::subcmd::{ + cmd::{JVCommand, JVCommandContext}, + errors::{CmdExecuteError, CmdPrepareError, CmdRenderError}, + renderer::{JVRenderResult, JVResultRenderer}, +}; + +pub struct JVStatusCommand; + +#[derive(Parser, Debug)] +pub struct JVStatusArgument; + +pub struct JVStatusInput; + +#[derive(Serialize)] +pub struct JVStatusOutput; + +impl JVCommand + for JVStatusCommand +{ + async fn prepare( + args: JVStatusArgument, + ctx: JVCommandContext, + ) -> Result { + todo!() + } + + async fn exec(args: JVStatusInput) -> Result { + todo!() + } + + fn get_help_str() -> String { + "".to_string() + } +} + +pub struct JVStatusRenderer; + +impl JVResultRenderer for JVStatusRenderer { + async fn render(data: &JVStatusOutput) -> Result { + todo!() + } +} diff --git a/src/subcmd/cmds/template.rs b/src/subcmd/cmds/template.rs new file mode 100644 index 0000000..8874121 --- /dev/null +++ b/src/subcmd/cmds/template.rs @@ -0,0 +1,45 @@ +use clap::Parser; +use serde::Serialize; + +use crate::subcmd::{ + cmd::JVCommand, + errors::{CmdExecuteError, CmdPrepareError, CmdRenderError}, + renderer::{JVRenderResult, JVResultRenderer}, +}; + +pub struct JVUnknownCommand; + +#[derive(Parser, Debug)] +pub struct JVUnknownArgument; + +pub struct JVUnknownInput; + +#[derive(Serialize)] +pub struct JVUnknownOutput; + +impl JVCommand + for JVUnknownCommand +{ + async fn prepare( + _args: JVUnknownArgument, + _ctx: JVCommandContext, + ) -> Result { + todo!() + } + + async fn exec(_args: JVUnknownInput) -> Result { + todo!() + } + + fn get_help_str() -> String { + "".to_string() + } +} + +pub struct JVStatusRenderer; + +impl JVResultRenderer for JVStatusRenderer { + async fn render(_data: &JVUnknownOutput) -> Result { + todo!() + } +} -- cgit