Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion libs/gl-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "glcli"
name = "gl-cli"
version = "0.1.0"
edition = "2021"
authors = ["Peter Neuroth <pet.v.ne@gmail.com>"]
Expand All @@ -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"
Expand Down
14 changes: 14 additions & 0 deletions libs/gl-cli/src/bin/glcli.rs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
18 changes: 3 additions & 15 deletions libs/gl-cli/src/main.rs → libs/gl-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand All @@ -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),
Expand All @@ -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")
Expand Down
Loading