From 7a4d2e6e372c52aeb57d1383343a87ad86b72876 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Fri, 30 Dec 2022 15:12:58 -0800 Subject: [PATCH] update exec hydrate opts --- d2plugin/exec.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/d2plugin/exec.go b/d2plugin/exec.go index cce95b5db..b004b5aff 100644 --- a/d2plugin/exec.go +++ b/d2plugin/exec.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "os/exec" + "strconv" "time" "oss.terrastruct.com/util-go/xdefer" @@ -68,13 +69,23 @@ func (p execPlugin) Flags(ctx context.Context) (_ []PluginSpecificFlag, err erro func (p *execPlugin) HydrateOpts(opts []byte) error { if opts != nil { - var execOpts map[string]string + var execOpts map[string]interface{} err := json.Unmarshal(opts, &execOpts) if err != nil { return xmain.UsageErrorf("non-exec layout options given for exec") } - p.opts = execOpts + allString := make(map[string]string) + for k, v := range execOpts { + switch vt := v.(type) { + case string: + allString[k] = vt + case int64: + allString[k] = strconv.Itoa(int(vt)) + } + } + + p.opts = allString } return nil }