From 1880bdf55ad89f7779340daab65c8e33e69fa312 Mon Sep 17 00:00:00 2001 From: Charlie Voiselle <464492+angrycub@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:06:15 -0400 Subject: [PATCH] Print relative variable names for dep variables --- sdk/pack/variables/variables.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sdk/pack/variables/variables.go b/sdk/pack/variables/variables.go index 07e100e4..e9bd7024 100644 --- a/sdk/pack/variables/variables.go +++ b/sdk/pack/variables/variables.go @@ -78,7 +78,13 @@ func (v *Variable) Equal(ivp *Variable) bool { func (v *Variable) AsOverrideString(pID pack.ID) string { var out strings.Builder - out.WriteString(fmt.Sprintf(`# variable "%s"`, v.Name)) + + fqvn := strings.Join([]string{pID.String(), v.Name.String()}, ".") + b := strings.Split(fqvn, ".") + b = b[1:] + rvn := strings.Join(b, ".") + + out.WriteString(fmt.Sprintf(`# variable "%s"`, rvn)) out.WriteByte('\n') if v.hasDescription { tmp := "description: " + v.Description @@ -100,9 +106,9 @@ func (v *Variable) AsOverrideString(pID pack.ID) string { } if v.Value.Equals(v.Default).True() { - out.WriteString(fmt.Sprintf("#\n# %s=%s\n\n", v.Name, printDefault(v.Default))) + out.WriteString(fmt.Sprintf("#\n# %s=%s\n\n", rvn, printDefault(v.Default))) } else { - out.WriteString(fmt.Sprintf("#\n%s=%s\n\n", v.Name, printDefault(v.Value))) + out.WriteString(fmt.Sprintf("#\n%s=%s\n\n", rvn, printDefault(v.Value))) } out.WriteString("\n")