fix ver
This commit is contained in:
27
src/main.rs
27
src/main.rs
@@ -8,15 +8,22 @@ use aigpt::mcp::MCPServer;
|
|||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "aigpt")]
|
#[command(name = "aigpt")]
|
||||||
#[command(about = "AI memory MCP server")]
|
#[command(about = "AI memory MCP server")]
|
||||||
#[command(version)]
|
#[command(disable_version_flag = true)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
#[arg(short = 'v', long = "version")]
|
||||||
|
version: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Option<Commands>,
|
command: Option<Commands>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
enum Commands {
|
enum Commands {
|
||||||
/// Initial setup: clone repo, link config, register MCP
|
/// Show version
|
||||||
|
#[command(name = "v")]
|
||||||
|
Version,
|
||||||
|
|
||||||
|
/// Initial setup: link config, register MCP
|
||||||
Setup,
|
Setup,
|
||||||
|
|
||||||
/// Start MCP server (JSON-RPC over stdio)
|
/// Start MCP server (JSON-RPC over stdio)
|
||||||
@@ -38,8 +45,18 @@ enum Commands {
|
|||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
if let Some(Commands::Setup) = &cli.command {
|
if cli.version {
|
||||||
return run_setup();
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
match &cli.command {
|
||||||
|
Some(Commands::Version) => {
|
||||||
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
Some(Commands::Setup) => return run_setup(),
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
config::init();
|
config::init();
|
||||||
@@ -75,7 +92,7 @@ fn main() -> Result<()> {
|
|||||||
println!("Saved. ({} records)", reader::memory_count());
|
println!("Saved. ({} records)", reader::memory_count());
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(Commands::Setup) => unreachable!(),
|
Some(Commands::Version) | Some(Commands::Setup) => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user