From c4edd29f50b6ada2cc3afd2f4df2ec47920c4607 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 11 Feb 2023 14:38:58 +0100 Subject: [PATCH] pull out args wip --- crates/dagger-codegen/src/handlers/fields.rs | 12 +++++++++++- crates/dagger-codegen/src/handlers/input.rs | 4 +--- crates/dagger-codegen/src/handlers/type_ref.rs | 8 -------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/dagger-codegen/src/handlers/fields.rs b/crates/dagger-codegen/src/handlers/fields.rs index 0136235..d02121a 100644 --- a/crates/dagger-codegen/src/handlers/fields.rs +++ b/crates/dagger-codegen/src/handlers/fields.rs @@ -39,7 +39,17 @@ pub fn render_fields(fields: &Vec) -> eyre::Result $(&args.args)) - ) -> $output { + ) -> $(&output) { + let query = self.selection.select("$(field.name.as_ref())"); + + let query = query.arg("args", args).unwrap(); + + $output { + conn: self.conn.clone(), + proc: self.proc.clone(), + selection: query, + } + todo!() } }); diff --git a/crates/dagger-codegen/src/handlers/input.rs b/crates/dagger-codegen/src/handlers/input.rs index 63e9054..c661ae0 100644 --- a/crates/dagger-codegen/src/handlers/input.rs +++ b/crates/dagger-codegen/src/handlers/input.rs @@ -20,7 +20,7 @@ impl Handler for Input { .ok_or(eyre::anyhow!("could not find name"))?; let description = render_description(t); - let input = rust::import("dagger_core", "Input"); + //let input = rust::import("dagger_core", "Input"); let fields = match t.input_fields.as_ref() { Some(i) => render_input_fields(i)?, @@ -32,8 +32,6 @@ impl Handler for Input { pub struct $name { $(if fields.is_some() => $fields) } - - impl $input for $name {} }; Ok(out) diff --git a/crates/dagger-codegen/src/handlers/type_ref.rs b/crates/dagger-codegen/src/handlers/type_ref.rs index b7c45e6..1096313 100644 --- a/crates/dagger-codegen/src/handlers/type_ref.rs +++ b/crates/dagger-codegen/src/handlers/type_ref.rs @@ -6,14 +6,6 @@ use crate::predicates::{ is_custom_scalar_type_ref, is_list_type, is_required_type_ref, is_scalar_type_ref, }; -//fn optional(t: rust::Tokens) -> impl FormatInto { -// quote_fn! {"Option<$[const](t)>"} -//} -// -//fn required(t: rust::Tokens) -> impl FormatInto { -// quote_fn! {"$[const](t)"} -//} - pub fn render_type_ref(inner: &TypeRef) -> eyre::Result { let extract_of_type = |t: &TypeRef| -> Option { return t.clone().of_type.map(|t| *t);