refactor: Use clap's built-in version command (#1145)
This commit is contained in:
@@ -2,4 +2,3 @@ pub mod agent_version;
|
|||||||
pub mod configure;
|
pub mod configure;
|
||||||
pub mod mcp;
|
pub mod mcp;
|
||||||
pub mod session;
|
pub mod session;
|
||||||
pub mod version;
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
pub fn print_version() {
|
|
||||||
println!(env!("CARGO_PKG_VERSION"))
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,6 @@ use commands::agent_version::AgentCommand;
|
|||||||
use commands::configure::handle_configure;
|
use commands::configure::handle_configure;
|
||||||
use commands::mcp::run_server;
|
use commands::mcp::run_server;
|
||||||
use commands::session::build_session;
|
use commands::session::build_session;
|
||||||
use commands::version::print_version;
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use goose::config::Config;
|
use goose::config::Config;
|
||||||
use logging::setup_logging;
|
use logging::setup_logging;
|
||||||
@@ -21,11 +20,8 @@ use std::io::{self, Read};
|
|||||||
mod test_helpers;
|
mod test_helpers;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(author, about, long_about = None)]
|
#[command(author, version, display_name = "", about, long_about = None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
#[arg(short = 'v', long = "version")]
|
|
||||||
version: bool,
|
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Option<Command>,
|
command: Option<Command>,
|
||||||
}
|
}
|
||||||
@@ -166,11 +162,6 @@ enum CliProviderVariant {
|
|||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
if cli.version {
|
|
||||||
print_version();
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
match cli.command {
|
match cli.command {
|
||||||
Some(Command::Configure {}) => {
|
Some(Command::Configure {}) => {
|
||||||
let _ = handle_configure().await;
|
let _ = handle_configure().await;
|
||||||
|
|||||||
Reference in New Issue
Block a user