Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2/hclsimple"
)
var (
package main
import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/gohcl"
"github.com/hashicorp/hcl/v2/hclsimple"
)
task "first_task" {
exec "list_current_dir" {
command = "ls ."
}
exec "list_var_dir" {
command = "ls /var"
}
}
type Config struct {
Tasks []*Task `hcl:"task,block"`
}
type Task struct {
Name string `hcl:"name,label"`
Steps []*ExecStep `hcl:"exec,block"`
}
type ExecStep struct {
Name string `hcl:"name,label"`
import (
"fmt"
"os"
"github.com/hashicorp/hcl/v2/hclsimple"
)
var (
exampleHCL = `
task "first_task" {
exec "list_current_dir" {
task "first_task" {
mkdir "build_dir" {
path = "./build"
}
exec "list_var_dir" {
command = "ls /var"
}
}
type Task struct {
Name string `hcl:"name,label"`
ExecSteps []*ExecStep `hcl:"exec,block"`
MkdirStep []*MkdirStep `hcl:"mkdir,block"`
}
task "first_task" {
step "mkdir" "build_dir" {
path = "./build/"
}
step "exec" "list_build_dir" {
command = "ls ./build/"
}
}
type Config struct {
Tasks []*Task `hcl:"task,block"`
}
type Task struct {
Name string `hcl:"name,label"`
Steps []*Step `hcl:"step,block"`
}
type Step struct {
type Runner interface {
Run() error
}