76 lines
1.6 KiB
Rust
76 lines
1.6 KiB
Rust
use clap::{Parser, Subcommand};
|
|
|
|
#[derive(Parser)]
|
|
#[command(name = "ias")]
|
|
#[command(version = "1.0")]
|
|
#[command(about = "Rust驱动的智能AI助手。")]
|
|
pub struct Cli {
|
|
#[command(subcommand)]
|
|
pub command: Commands,
|
|
}
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
pub enum Commands {
|
|
// 启动服务
|
|
Service {
|
|
#[command(subcommand)]
|
|
command: Option<ServiceAction>,
|
|
},
|
|
// 配置渠道
|
|
Channel {
|
|
#[command(subcommand)]
|
|
command: Channels,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Clone, Subcommand)]
|
|
pub enum ServiceAction {
|
|
/// 前台运行服务
|
|
Run,
|
|
/// 后台启动服务
|
|
Start,
|
|
/// 停止后台服务
|
|
Stop,
|
|
/// 重启后台服务
|
|
Restart,
|
|
/// 查看服务运行状态
|
|
Status,
|
|
/// 查看后台服务日志
|
|
Logs {
|
|
/// 输出最后多少行日志
|
|
#[arg(short, long, default_value_t = 80)]
|
|
lines: usize,
|
|
},
|
|
}
|
|
|
|
#[derive(Debug, Subcommand)]
|
|
pub enum Channels {
|
|
// 微信渠道配置
|
|
Wechat {
|
|
#[command(subcommand)]
|
|
command: WechatAction,
|
|
},
|
|
}
|
|
#[derive(Debug, Subcommand)]
|
|
pub enum WechatAction {
|
|
/// 登录新的微信账号
|
|
Login,
|
|
/// 查看已经登录的微信账号
|
|
List,
|
|
/// 删除已登录的微信账号
|
|
Delete {
|
|
/// 要删除的微信账号
|
|
#[arg(short, long)]
|
|
account: String,
|
|
},
|
|
/// 修改账号名称 - 仅做标记,与微信名无关
|
|
Rename {
|
|
/// 要修改的微信账号
|
|
#[arg(short, long)]
|
|
account: String,
|
|
/// 名称 仅做标记
|
|
#[arg(short, long)]
|
|
name: String,
|
|
},
|
|
}
|