{do:"subdir"} to select a subdirectory in a script

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes
2021-02-04 19:38:05 +00:00
parent 0202f4447b
commit 622de21883
5 changed files with 68 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
package main
hello: {
string
#dagger: compute: [
{
do: "fetch-container"
ref: "alpine"
},
{
do: "exec"
args: ["mkdir", "-p", "/tmp/foo"]
},
{
do: "exec"
args: ["sh", "-c", "echo -n world > /tmp/foo/hello"]
},
{
do: "subdir"
dir: "/tmp/foo"
},
{
do: "export"
source: "/hello"
format: "string"
},
]
}

View File

@@ -217,6 +217,11 @@ test::input() {
}
test::subdir() {
test::one "Subdir: simple usage" --exit=0 --stdout='{"hello":"world"}' \
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute "$d"/subdir/simple
}
test::all(){
local dagger="$1"
@@ -231,6 +236,7 @@ test::all(){
test::exec "$dagger"
test::export "$dagger"
test::input "$dagger"
test::subdir "$dagger"
}
case "${1:-all}" in