diff --git a/Cargo.lock b/Cargo.lock index 705ceeea4..ac0a114dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1306,6 +1306,21 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "gl-cli" +version = "0.1.0" +dependencies = [ + "clap", + "dirs", + "env_logger 0.11.5", + "futures", + "gl-client", + "hex", + "thiserror 2.0.11", + "tokio 1.43.0", + "vls-core", +] + [[package]] name = "gl-client" version = "0.3.0" @@ -1444,21 +1459,6 @@ dependencies = [ "which 4.4.2", ] -[[package]] -name = "glcli" -version = "0.1.0" -dependencies = [ - "clap", - "dirs", - "env_logger 0.11.5", - "futures", - "gl-client", - "hex", - "thiserror 2.0.11", - "tokio 1.43.0", - "vls-core", -] - [[package]] name = "governor" version = "0.5.1" diff --git a/libs/gl-cli/Cargo.toml b/libs/gl-cli/Cargo.toml index 2dbbd5fa8..47f8446a6 100644 --- a/libs/gl-cli/Cargo.toml +++ b/libs/gl-cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "glcli" +name = "gl-cli" version = "0.1.0" edition = "2021" authors = ["Peter Neuroth "] @@ -12,6 +12,11 @@ categories = ["command-line-utlis", "cryptography::cryptocurrencies"] license = "MIT" reademe = "README.md" +[[bin]] +name = "glcli" +test = true +doc = true + [dependencies] clap = { version = "4.5", features = ["derive"] } dirs = "6.0" diff --git a/libs/gl-cli/src/bin/glcli.rs b/libs/gl-cli/src/bin/glcli.rs new file mode 100644 index 000000000..d224311c6 --- /dev/null +++ b/libs/gl-cli/src/bin/glcli.rs @@ -0,0 +1,14 @@ +use clap::Parser; +use gl_cli::{run, Cli}; + +#[tokio::main] +async fn main() { + let cli = Cli::parse(); + + match run(cli).await { + Ok(()) => (), + Err(e) => { + println!("{}", e); + } + } +} diff --git a/libs/gl-cli/src/main.rs b/libs/gl-cli/src/lib.rs similarity index 90% rename from libs/gl-cli/src/main.rs rename to libs/gl-cli/src/lib.rs index bc6501e5d..4a1c96f4a 100644 --- a/libs/gl-cli/src/main.rs +++ b/libs/gl-cli/src/lib.rs @@ -11,7 +11,7 @@ mod util; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] -struct Cli { +pub struct Cli { /// The directory containing the seed and the credentials #[arg(short, long, global = true, help_heading = "Global options")] data_dir: Option, @@ -25,7 +25,7 @@ struct Cli { } #[derive(Subcommand, Debug)] -enum Commands { +pub enum Commands { /// Interact with the scheduler that is the brain of most operations #[command(subcommand)] Scheduler(scheduler::Command), @@ -37,19 +37,7 @@ enum Commands { Node(node::Command), } -#[tokio::main] -async fn main() { - let cli = Cli::parse(); - - match run(cli).await { - Ok(()) => (), - Err(e) => { - println!("{}", e); - } - } -} - -async fn run(cli: Cli) -> Result<()> { +pub async fn run(cli: Cli) -> Result<()> { if cli.verbose { if std::env::var("RUST_LOG").is_err() { std::env::set_var("RUST_LOG", "debug")