Clean up registry types.

pull/256/head
jackgr 9 years ago
parent 440af2fabd
commit 2cdb34fd96

@ -166,6 +166,10 @@ func execute() {
switch args[0] {
case "templates":
path := fmt.Sprintf("registries/%s/types", *templateRegistry)
if *regexString != "" {
path += fmt.Sprintf("?%s", url.QueryEscape(*regexString))
}
callService(path, "GET", "list templates", nil)
case "describe":
if len(args) != 2 {

@ -495,12 +495,18 @@ func listRegistryTypesHandlerFunc(w http.ResponseWriter, r *http.Request) {
return
}
values, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
util.LogAndReturnError(handler, http.StatusBadRequest, err, w)
return
}
var regex *regexp.Regexp
regexString, err := getPathVariable(w, r, "regex", handler)
if err == nil {
regexString := values.Get("regex")
if regexString != "" {
regex, err = regexp.Compile(regexString)
if err != nil {
util.LogAndReturnError(handler, http.StatusInternalServerError, err, w)
util.LogAndReturnError(handler, http.StatusBadRequest, err, w)
return
}
}

Loading…
Cancel
Save