Repository navigation
Add support for advanced ${} uses - #11149
Conversation
|
LGTM |
|
Interesting usecase: #9731 |
|
94379ae and 76ac2e3 have the same commit message. can you squash/edit? |
3b499dc to
c80fe2f
Compare
|
I'm closing this until we merge the dependency. We can reopen after :) |
|
Huh? Is that really the normal process? Seems odd to me. |
|
@duglin yes :) We actually had a discussion this morning about PR dependencies, and we do this every now and then, we may not be enforcing it well enough. |
|
Obviously that means the other PR needs to be approved. ☺ -Doug Sent from my iPhone
|
50dfef1 to
00ef54c
Compare
|
Moving this in I like the feature, and the implementation is simple enough, so +1. |
|
ping @tiborvass |
|
@duglin what would be the ways people could abuse it? |
|
@tiborvass can you elaborate? I'm not sure what you're looking for. Not sure how people could "abuse" an environment variable. |
|
I mean the reason this PR exists is because of PATH=$PATH:/foo/bar would result in :/foo/bar if @tianon can you think of anything? Actually, now that I think about it, we should have kept @duglin to be honest, at this point, you are right, I don't see why we wouldn't support ${}. |
|
@tiborvass yes |
|
More seriously, with what we've already got support for, this does make sense. It hurts that we're reimplementing so many shell features, but we're already down the hole a ways and can't back out now. 👍 |
|
Nope I've no argument, sorry if I communicated otherwise. |
|
@erikh if you get a chance, I wouldn't mind your thoughts on: https://github.com/duglin/docker/tree/Script cd into 'test' and then build that Dockerfile. |
There was a problem hiding this comment.
What about:
switch modifier {
case "-":
newValue := sw.getEnv(name)
// ...
case "+":
newValue := sw.getEnv(name)
// ...
default:
// return error
}
There was a problem hiding this comment.
As you wish....
On Mar 31, 2015, at 5:08 PM, Tibor Vass [email protected] wrote:
In builder/shell_parser.go #11149 (comment):
@@ -157,7 +157,38 @@ func (sw *shellWord) processDollar() (string, error) {
sw.next()
return sw.getEnv(name), nil
}
return "", fmt.Errorf("Unsupported ${} substitution: %s", sw.word)if ch == ':' {// Special ${xx:...} format processing// Yes it allows for recursive $'s in the ... spotsw.next()modifier := sw.next() What about:if strings.Index("-+", string(modifier)) < 0 {switch modifier {
case "-":
newValue := sw.getEnv(name)
// ...
case "+":
newValue := sw.getEnv(name)
// ...
default:
// return error
}
—
Reply to this email directly or view it on GitHub https://github.com/docker/docker/pull/11149/files#r27523426.
00ef54c to
23a1a5f
Compare
|
LGTM Ping @erikh |
|
Just noticing this whole lib now; nice! LGTM. |
Just ${xxx:+...} and ${xxx:-...} for now
Signed-off-by: Doug Davis <[email protected]>
23a1a5f to
39908fc
Compare
|
fixed @jamtur01's docs comment |
|
Docs LGTM |
|
is this ready to merge? |
|
@duglin Yes :) |
Add support for advanced ${} uses
|
thanks!! |
|
🎉😃 |

In particular ${xxx:+...} and ${xxx:-...}
This depends on #10431Closes #8667