I was pretty much following the documentation and playing in my PC. Here is the “localdev.cue” file:
package main
import (
"strings"
"dagger.io/dagger"
"dagger.io/dagger/core"
)
dagger.#Plan & {
client: commands: {
os: {
// notice: this command isn't available on Windows
name: "uname"
args: ["-s"]
}
arch: {
name: "uname"
args: ["-m"]
}
go: {
name: "go"
args: ["version"]
}
hugo: {
name: "hugo"
args: ["version"]
}
}
actions: test: {
// using #Nop because we need an action for the outputs
_os: core.#Nop & {
// command outputs usually add a new line, you can trim it
input: strings.TrimSpace(client.commands.os.stdout)
}
_arch: core.#Nop & {
// we access the command's output via the `stdout` field
input: strings.TrimSpace(client.commands.arch.stdout)
}
_go: core.#Nop & {
// we access the command's output via the `stdout` field
input: strings.TrimSpace(client.commands.go.stdout)
}
_hugo: core.#Nop & {
// we access the command's output via the `stdout` field
input: strings.TrimSpace(client.commands.hugo.stdout)
}
// action outputs for debugging
os: _os.output
arch: _arch.output
go: _go.output
hugo: _hugo.output
}
}
Then, assuming that dagger is installed already, we can do the following:
❯ dagger do test
[✔] client.commands.hugo 0.0s
[✔] client.commands.os 0.0s
[✔] client.commands.go 0.0s
[✔] client.commands.arch 0.0s
[✔] actions.test 0.0s
Field Value
os "Darwin"
arch "arm64"
go "go version go1.18.3 darwin/arm64"
hugo "hugo v0.101.0+extended darwin/arm64 BuildDate=unknown"
I am not sure if Dagger could help to what I have in mind, but that is the reason I will try to play a bit more with it.