From 986a64cbc7b2bf2fe34667caec58c24e0d35374c Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sun, 19 Feb 2023 15:24:37 +0100 Subject: [PATCH] feat(sdk): re-export through lib.rs this means that you can now use dagger_sdk::connect() instead of dagger_sdk::client::connect(); --- .../examples/build-the-application/main.rs | 4 ++-- crates/dagger-sdk/examples/caching/main.rs | 4 ++-- .../examples/existing-dockerfile/main.rs | 2 +- .../examples/first-pipeline/main.rs | 2 +- .../examples/multi-stage-build/main.rs | 4 ++-- .../examples/publish-the-application/main.rs | 4 ++-- .../examples/test-the-application/main.rs | 4 ++-- crates/dagger-sdk/src/lib.rs | 20 ++++--------------- crates/dagger-sdk/tests/mod.rs | 3 +-- src/main.rs | 2 -- 10 files changed, 17 insertions(+), 32 deletions(-) diff --git a/crates/dagger-sdk/examples/build-the-application/main.rs b/crates/dagger-sdk/examples/build-the-application/main.rs index ba204c8..f6a984e 100644 --- a/crates/dagger-sdk/examples/build-the-application/main.rs +++ b/crates/dagger-sdk/examples/build-the-application/main.rs @@ -1,7 +1,7 @@ -use dagger_sdk::gen::HostDirectoryOpts; +use dagger_sdk::HostDirectoryOpts; fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let host_source_dir = client.host().directory( "examples/build-the-application/app".into(), diff --git a/crates/dagger-sdk/examples/caching/main.rs b/crates/dagger-sdk/examples/caching/main.rs index 2761295..bce0fc1 100644 --- a/crates/dagger-sdk/examples/caching/main.rs +++ b/crates/dagger-sdk/examples/caching/main.rs @@ -1,8 +1,8 @@ -use dagger_sdk::gen::HostDirectoryOpts; +use dagger_sdk::HostDirectoryOpts; use rand::Rng; fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let host_source_dir = client.host().directory( "./examples/caching/app".into(), diff --git a/crates/dagger-sdk/examples/existing-dockerfile/main.rs b/crates/dagger-sdk/examples/existing-dockerfile/main.rs index 086e425..e14fcba 100644 --- a/crates/dagger-sdk/examples/existing-dockerfile/main.rs +++ b/crates/dagger-sdk/examples/existing-dockerfile/main.rs @@ -3,7 +3,7 @@ use rand::Rng; fn main() -> eyre::Result<()> { let mut rng = rand::thread_rng(); - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let context_dir = client .host() diff --git a/crates/dagger-sdk/examples/first-pipeline/main.rs b/crates/dagger-sdk/examples/first-pipeline/main.rs index c1fbd5a..dfc9209 100644 --- a/crates/dagger-sdk/examples/first-pipeline/main.rs +++ b/crates/dagger-sdk/examples/first-pipeline/main.rs @@ -1,5 +1,5 @@ fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let version = client .container(None) diff --git a/crates/dagger-sdk/examples/multi-stage-build/main.rs b/crates/dagger-sdk/examples/multi-stage-build/main.rs index 63fe24a..64468e9 100644 --- a/crates/dagger-sdk/examples/multi-stage-build/main.rs +++ b/crates/dagger-sdk/examples/multi-stage-build/main.rs @@ -1,8 +1,8 @@ -use dagger_sdk::gen::HostDirectoryOpts; +use dagger_sdk::HostDirectoryOpts; use rand::Rng; fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let host_source_dir = client.host().directory( "examples/publish-the-application/app".into(), diff --git a/crates/dagger-sdk/examples/publish-the-application/main.rs b/crates/dagger-sdk/examples/publish-the-application/main.rs index 07935dc..80a6ea1 100644 --- a/crates/dagger-sdk/examples/publish-the-application/main.rs +++ b/crates/dagger-sdk/examples/publish-the-application/main.rs @@ -1,8 +1,8 @@ -use dagger_sdk::gen::HostDirectoryOpts; +use dagger_sdk::HostDirectoryOpts; use rand::Rng; fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let output = "examples/publish-the-application/app/build"; let host_source_dir = client.host().directory( diff --git a/crates/dagger-sdk/examples/test-the-application/main.rs b/crates/dagger-sdk/examples/test-the-application/main.rs index 795b707..1c7983e 100644 --- a/crates/dagger-sdk/examples/test-the-application/main.rs +++ b/crates/dagger-sdk/examples/test-the-application/main.rs @@ -1,7 +1,7 @@ -use dagger_sdk::gen::HostDirectoryOpts; +use dagger_sdk::HostDirectoryOpts; fn main() -> eyre::Result<()> { - let client = dagger_sdk::client::connect()?; + let client = dagger_sdk::connect()?; let host_source_dir = client.host().directory( "examples/test-the-application/app".into(), diff --git a/crates/dagger-sdk/src/lib.rs b/crates/dagger-sdk/src/lib.rs index b675c7e..12fc359 100644 --- a/crates/dagger-sdk/src/lib.rs +++ b/crates/dagger-sdk/src/lib.rs @@ -1,18 +1,6 @@ -pub mod client; -pub mod gen; +mod client; +mod gen; mod querybuilder; -pub fn add(left: usize, right: usize) -> usize { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} +pub use client::*; +pub use gen::*; diff --git a/crates/dagger-sdk/tests/mod.rs b/crates/dagger-sdk/tests/mod.rs index 17273ba..cdc317f 100644 --- a/crates/dagger-sdk/tests/mod.rs +++ b/crates/dagger-sdk/tests/mod.rs @@ -1,5 +1,4 @@ -use dagger_sdk::client::connect; -use dagger_sdk::gen::ContainerExecOpts; +use dagger_sdk::{connect, ContainerExecOpts}; #[test] fn test_example_container() { diff --git a/src/main.rs b/src/main.rs index 2fe74bc..a9cbd75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,8 +4,6 @@ pub mod cli; mod cli_generate; fn main() -> eyre::Result<()> { - // - color_eyre::install().unwrap(); let args = std::env::args();