builder/parser: Make use of builder/command

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
Ahmet Alp Balkan 2015-02-11 23:54:41 -08:00
parent ccde3a1f73
commit 72a070c5da
1 changed files with 16 additions and 14 deletions

View File

@ -7,6 +7,8 @@ import (
"regexp" "regexp"
"strings" "strings"
"unicode" "unicode"
"github.com/docker/docker/builder/command"
) )
// Node is a structure used to represent a parse tree. // Node is a structure used to represent a parse tree.
@ -44,20 +46,20 @@ func init() {
// functions. Errors are propagated up by Parse() and the resulting AST can // functions. Errors are propagated up by Parse() and the resulting AST can
// be incorporated directly into the existing AST as a next. // be incorporated directly into the existing AST as a next.
dispatch = map[string]func(string) (*Node, map[string]bool, error){ dispatch = map[string]func(string) (*Node, map[string]bool, error){
"user": parseString, command.User: parseString,
"onbuild": parseSubCommand, command.Onbuild: parseSubCommand,
"workdir": parseString, command.Workdir: parseString,
"env": parseEnv, command.Env: parseEnv,
"maintainer": parseString, command.Maintainer: parseString,
"from": parseString, command.From: parseString,
"add": parseMaybeJSONToList, command.Add: parseMaybeJSONToList,
"copy": parseMaybeJSONToList, command.Copy: parseMaybeJSONToList,
"run": parseMaybeJSON, command.Run: parseMaybeJSON,
"cmd": parseMaybeJSON, command.Cmd: parseMaybeJSON,
"entrypoint": parseMaybeJSON, command.Entrypoint: parseMaybeJSON,
"expose": parseStringsWhitespaceDelimited, command.Expose: parseStringsWhitespaceDelimited,
"volume": parseMaybeJSONToList, command.Volume: parseMaybeJSONToList,
"insert": parseIgnore, command.Insert: parseIgnore,
} }
} }