Skip to content

Commit

Permalink
cargo.toml separating
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravm committed Jul 15, 2024
1 parent 7fe8709 commit a76ddd3
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 114 deletions.
42 changes: 11 additions & 31 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
workspace = { members = ["cli/ga4gh-sdk-cli"] }
[package]
name = "ga4gh-sdk"
[workspace]
members = [
"cli",
"lib"
]

[workspace.package]
version = "0.1.0"
authors = ["Aarav Mehta <[email protected]>", "Pavel Nikonorov", "ELIXIR Cloud & AAI <[email protected]>"]
authors = ["Aarav Mehta <[email protected]> (Google Summer of Code Participant)", "Pavel Nikonorov <[email protected]> (Google Summer of Code Mentor; GENXT)", "ELIXIR Cloud & AAI <[email protected]> (ELIXIR Europe)"]
edition = "2021"
description = "Generic SDK and CLI for GA4GH API services"
license = "Apache-2.0"
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk.git"

[dependencies]
tokio = { version = "1", features = ["full"] }
serde = "^1.0"
serde_derive = "^1.0"
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
log = "0.4"
env_logger = "0.9"
once_cell = "1.8.0"

[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]

[dev-dependencies]
mockito = "0.31"
mockall = "0.10.2"
cargo-nextest = "0.9.30"

[lib]
name = "ga4gh_sdk"
path = "lib/src/lib.rs"
readme = "./README.md"
license-file = "LICENSE.txt"
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk.git"
21 changes: 21 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "cli"
description = """
A cross-platform CLI tool written in Rust to use GA4GH-sdk
"""
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk/tree/main/cli"
version.workspace = true
authors.workspace = true
edition.workspace = true
readme.workspace = true
license-file.workspace = true

[dependencies]
ga4gh-lib = { path = "../lib" }
clap = "3.0"
clap_complete = "3.0"
tokio = { version = "1", features = ["full"] }

[[bin]]
name = "cli"
path = "src/main.rs"
8 changes: 0 additions & 8 deletions cli/ga4gh-sdk-cli/Cargo.toml

This file was deleted.

75 changes: 0 additions & 75 deletions cli/ga4gh-sdk-cli/src/main.rs

This file was deleted.

50 changes: 50 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
use clap::{arg, Command};
use std::error::Error;
use crate::tes;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut cmd = Command::new("cli")
.bin_name("cli")
.version("1.0")
.about("CLI to manage tasks")
.subcommand_required(true)
.arg_required_else_help(true)
.subcommand(
Command::new("tes")
.about("TES subcommands")
.subcommand_required(true)
.arg_required_else_help(true)
.subcommand(
Command::new("create")
.about("Create a task")
.arg(arg!(<TASK_FILE> "The task file to create"))
.arg(arg!(--url <URL> "The URL for the task").required(true))
.arg_required_else_help(true),
)
);

let matches = cmd.clone().get_matches();

match matches.subcommand() {
Some(("tes", sub)) => {
match sub.subcommand() {
Some(("create", sub)) => {
let task_file = sub.value_of("TASK_FILE").unwrap();
let url = sub.value_of("url").unwrap();
tes::create(task_file, url).await?;
}
_ => {}
}
}
_ => {}
}
Ok(())
}

// lib/src/tes/mod.rs
pub async fn create(task_file: &str, url: &str) -> Result<(), Box<dyn Error>> {
// Your implementation here
println!("Creating task with file: {} and URL: {}", task_file, url);
Ok(())
}
36 changes: 36 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "ga4gh-lib"
description = """
Generic SDK and CLI for GA4GH API services
"""
repository = "https://github.com/elixir-cloud-aai/ga4gh-sdk/tree/main/lib"
version.workspace = true
authors.workspace = true
edition.workspace = true
readme.workspace = true
license-file.workspace = true
# rust-version = "1.74"

[dependencies]
tokio = { version = "1", features = ["full"] }
serde = "^1.0"
serde_derive = "^1.0"
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
log = "0.4"
env_logger = "0.9"
once_cell = "1.8.0"

[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]

[dev-dependencies]
mockito = "0.31"
mockall = "0.10.2"
cargo-nextest = "0.9.30"

[lib]
name = "ga4gh_sdk"
path = "lib/src/lib.rs"

0 comments on commit a76ddd3

Please sign in to comment.