From 3f514e0fa7aef4636253c8a0c9286dd7ab71784f Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 30 Apr 2021 23:37:47 +0000 Subject: [PATCH] stdlib: dagger.io/io.#Dir Signed-off-by: Solomon Hykes --- stdlib/io/io.cue | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/stdlib/io/io.cue b/stdlib/io/io.cue index c057eb60..3fb71d4b 100644 --- a/stdlib/io/io.cue +++ b/stdlib/io/io.cue @@ -5,6 +5,32 @@ import ( "dagger.io/dagger/op" ) +#Dir: { + from: dagger.#Artifact + path: string + + // Read the tree structure (not file contents) + read: tree: { + string// FIXME: only raw 'find' output for now + #up: [ + op.#FetchContainer & { + ref: "alpine" // FIXME: use alpine or docker package + }, + op.#Exec & { + mount: "/data": "from": from + args: [ + "sh", "-c", + #"find /data | sed 's/^\/data//' > /export.txt"#, + ] + }, + op.#Export & { + source: "/export.txt" + format: "string" + }, + ] + } +} + #File: { from: dagger.#Artifact path: string