Skip to content

Commit

Permalink
glcli: Rename package
Browse files Browse the repository at this point in the history
In ordert to stick to the naming scheme that has established around
greenlight crates which is `gl-<package>` we change the name of the
crate to be published to crates.io. When using the binary, the newly
introduced hyphen might be a bit cumbersome so we keep the name of the
binary `glcli`.

Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
  • Loading branch information
nepet committed Feb 11, 2025
1 parent e895ada commit 62d25c9
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 30 deletions.
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);
}
}
}
28 changes: 14 additions & 14 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,19 @@ enum Commands {
Node(node::Command),
}

#[tokio::main]
async fn main() {
let cli = Cli::parse();
//#[tokio::main]
//async fn main() {
// let cli = Cli::parse();
//
// match run(cli).await {
// Ok(()) => (),
// Err(e) => {
// println!("{}", e);
// }
// }
//}

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

0 comments on commit 62d25c9

Please sign in to comment.