-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |