feat: add basic structure
This commit is contained in:
parent
5fbae8abd6
commit
50e4d5a879
9
Cargo.lock
generated
9
Cargo.lock
generated
@ -62,10 +62,6 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "char"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "char_cli"
|
name = "char_cli"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -82,12 +78,15 @@ dependencies = [
|
|||||||
name = "char_plan"
|
name = "char_plan"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"char",
|
"char_sdk",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "char_sdk"
|
name = "char_sdk"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"eyre",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = ["examples/service/char_plan", "crates/char_cli", "crates/char_sdk"]
|
||||||
"examples/service/char_plan",
|
|
||||||
"crates/char_cli",
|
|
||||||
"crates/char_sdk",
|
|
||||||
"crates/char",
|
|
||||||
]
|
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "char"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
@ -6,3 +6,4 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
eyre = { workspace = true }
|
||||||
|
@ -1,14 +1,28 @@
|
|||||||
pub fn add(left: usize, right: usize) -> usize {
|
pub mod std;
|
||||||
left + right
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
pub trait Action {}
|
||||||
mod tests {
|
pub trait Plugin {}
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
pub struct CharBuilder;
|
||||||
fn it_works() {
|
|
||||||
let result = add(2, 2);
|
impl CharBuilder {
|
||||||
assert_eq!(result, 4);
|
pub fn new() -> Self {
|
||||||
|
CharBuilder
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_context<C>(mut self, context: C) -> Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_action(mut self, action: impl Action) -> Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_plugin(mut self, plugin: impl Plugin) -> Self {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute(mut self) -> eyre::Result<()> {
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
crates/char_sdk/src/std/dagger/mod.rs
Normal file
7
crates/char_sdk/src/std/dagger/mod.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
pub struct Context {}
|
||||||
|
|
||||||
|
impl Default for Context {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
9
crates/char_sdk/src/std/k8s/mod.rs
Normal file
9
crates/char_sdk/src/std/k8s/mod.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
pub struct Plugin {}
|
||||||
|
|
||||||
|
impl crate::Plugin for Plugin {}
|
||||||
|
|
||||||
|
impl Default for Plugin {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
2
crates/char_sdk/src/std/mod.rs
Normal file
2
crates/char_sdk/src/std/mod.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub mod dagger;
|
||||||
|
pub mod k8s;
|
@ -6,4 +6,4 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
char = { path = "../../../crates/char" }
|
char_sdk = { path = "../../../crates/char_sdk" }
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
struct Run;
|
struct Run;
|
||||||
impl char::Action for Run {}
|
impl char_sdk::Action for Run {}
|
||||||
|
|
||||||
struct Build;
|
struct Build;
|
||||||
impl char::Action for Build {}
|
impl char_sdk::Action for Build {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
char::new()
|
char_sdk::CharBuilder::new()
|
||||||
.add_context(char::dagger::Context::default())
|
.add_context(char_sdk::std::dagger::Context::default())
|
||||||
.add_action(Run {})
|
.add_action(Run {})
|
||||||
.add_action(Build {})
|
.add_action(Build {})
|
||||||
.add_plugin(char::std::k8s::Context::default())
|
.add_plugin(char_sdk::std::k8s::Plugin::default())
|
||||||
.execute();
|
.execute()
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user