示例#1
0
func ExpandContainerCommandAndArgs(container *api.Container, envs []EnvVar) (command []string, args []string) {
	mapping := expansion.MappingFuncFor(EnvVarsToMap(envs))

	if len(container.Command) != 0 {
		for _, cmd := range container.Command {
			command = append(command, expansion.Expand(cmd, mapping))
		}
	}

	if len(container.Args) != 0 {
		for _, arg := range container.Args {
			args = append(args, expansion.Expand(arg, mapping))
		}
	}

	return command, args
}
示例#2
0
func expandOsArgs() []string {

	args := []string{}

	if len(os.Args) != 0 {
		for _, cmd := range os.Args {
			args = append(args, expansion.Expand(cmd, os.Getenv))
		}
	}

	return args
}