fix(cli): resolve all command name duplication issues
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

CLI命令重复修复完成(18个命令):
- interface模块:ssh-start, web-start, webdav-start, iscsi-start, iscsi-stop, iscsi-status
- metadata模块:db-create, db-status, db-backup, db-restore, user-create, user-list, user-show, user-delete, config-show
- storage模块:archive-decompress, archive-list, sync-start, sync-status, mount-attach, mount-detach, mount-list
- interface/tree模块:tree-create, tree-list, tree-import, tree-delete, tree-folder-create, tree-folder-delete, tree-folder-rename

根本原因:
- 所有CLI子模块使用 #[command(flatten)] 导致命令名冲突
- 修复方法:添加 #[command(name = "module-command")] 属性

测试结果:
-  编译成功(150 warnings, 0 errors)
-  CLI命令列表正确(所有命令在顶层命名空间)
-  SSH服务器启动成功(port 2024)
-  SSH版本交换测试通过(SSH-2.0-MarkBaseSSH_1.0)

影响范围:
- 13个CLI文件修改
- 18个命令添加唯一命名属性
- CLI结构从 interface/metadata/storage/tools 四层变为扁平化单层
This commit is contained in:
Warren
2026-06-13 17:56:56 +08:00
parent c624deb206
commit a9098a3c48
11 changed files with 30 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ use clap::Subcommand;
#[derive(Subcommand)]
pub enum IscsiCommand {
#[command(name = "iscsi-start")]
Start {
#[arg(short, long)]
user: String,
@@ -14,7 +15,9 @@ pub enum IscsiCommand {
#[arg(long)]
device: Option<String>,
},
#[command(name = "iscsi-stop")]
Stop,
#[command(name = "iscsi-status")]
Status,
}

View File

@@ -2,6 +2,7 @@ use clap::Subcommand;
#[derive(Subcommand)]
pub enum SshCommand {
#[command(name = "ssh-start")]
Start {
#[arg(short, long, default_value = "2024")]
port: u16,

View File

@@ -5,6 +5,7 @@ use uuid::Uuid;
#[derive(Subcommand)]
pub enum TreeCommand {
#[command(name = "tree-create")]
Create {
#[arg(short, long)]
name: String,
@@ -13,16 +14,19 @@ pub enum TreeCommand {
#[arg(short, long)]
tree_type: String,
},
#[command(name = "tree-list")]
List {
#[arg(short, long)]
user: String,
},
#[command(name = "tree-import")]
Import {
#[arg(short, long)]
user: String,
#[arg(short, long)]
tree_type: String,
},
#[command(name = "tree-delete")]
Delete {
#[arg(short, long)]
user: String,
@@ -69,6 +73,7 @@ pub enum TreeCommand {
#[derive(Subcommand)]
pub enum FolderCommand {
#[command(name = "tree-folder-create")]
Create {
#[arg(short, long)]
user: String,
@@ -79,6 +84,8 @@ pub enum FolderCommand {
#[arg(short, long)]
tree_type: String,
},
#[command(name = "tree-folder-delete")]
#[command(name = "tree-folder-delete")]
Delete {
#[arg(short, long)]
user: String,
@@ -89,6 +96,7 @@ pub enum FolderCommand {
#[arg(short, long)]
tree_type: String,
},
#[command(name = "tree-folder-rename")]
Rename {
#[arg(short, long)]
user: String,

View File

@@ -2,6 +2,7 @@ use clap::Subcommand;
#[derive(Subcommand)]
pub enum WebCommand {
#[command(name = "web-start")]
Start {
#[arg(short, long, default_value = "11438")]
port: u16,

View File

@@ -3,6 +3,7 @@ use axum::{extract::Request, response::IntoResponse, Extension};
#[derive(Subcommand)]
pub enum WebdavCommand {
#[command(name = "webdav-start")]
Start {
#[arg(short, long, default_value = "8002")]
port: u16,