Actually fix variable expansion.
This commit is contained in:
parent
9403175f0a
commit
c8987c4e97
1 changed files with 8 additions and 3 deletions
11
expand.go
11
expand.go
|
|
@ -59,11 +59,16 @@ func expand(input string, vars map[string][]string, expandBackticks bool) []stri
|
||||||
var outparts []string
|
var outparts []string
|
||||||
outparts, off = expandSigil(input[i:], vars)
|
outparts, off = expandSigil(input[i:], vars)
|
||||||
if len(outparts) > 0 {
|
if len(outparts) > 0 {
|
||||||
parts = append(parts, expanded+outparts[0])
|
firstpart := expanded + outparts[0]
|
||||||
if len(outparts) > 1 {
|
if len(outparts) > 1 {
|
||||||
parts = append(parts, outparts[1:len(outparts)-1]...)
|
parts = append(parts, firstpart)
|
||||||
|
if len(outparts) > 2 {
|
||||||
|
parts = append(parts, outparts[1:len(outparts)-1]...)
|
||||||
|
}
|
||||||
|
expanded = outparts[len(outparts)-1]
|
||||||
|
} else {
|
||||||
|
expanded = firstpart
|
||||||
}
|
}
|
||||||
expanded = parts[len(parts)-1]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue