func getLargestActionNameSize()

in commands/api.go [735:766]


func getLargestActionNameSize(retApiArray *whisk.RetApiArray, apiPath string, apiVerb string) int {
	var maxNameSize = 0
	for i := 0; i < len(retApiArray.Apis); i++ {
		var resultApi = retApiArray.Apis[i].ApiValue
		if resultApi.Swagger != nil && resultApi.Swagger.Paths != nil {
			for path := range resultApi.Swagger.Paths {
				whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing api relpath: '%s'\n", path)
				if len(apiPath) == 0 || path == apiPath {
					whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: relpath matches\n")
					for op, opv := range resultApi.Swagger.Paths[path].MakeOperationMap() {
						whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: comparing operation: '%s'\n", op)
						if len(apiVerb) == 0 || strings.ToLower(op) == strings.ToLower(apiVerb) {
							whisk.Debug(whisk.DbgInfo, "getLargestActionNameSize: operation matches: %#v\n", opv)
							var fullActionName string
							if opv.XOpenWhisk == nil {
								fullActionName = ""
							} else if len(opv.XOpenWhisk.Package) > 0 {
								fullActionName = "/" + opv.XOpenWhisk.Namespace + "/" + opv.XOpenWhisk.Package + "/" + opv.XOpenWhisk.ActionName
							} else {
								fullActionName = "/" + opv.XOpenWhisk.Namespace + "/" + opv.XOpenWhisk.ActionName
							}
							if len(fullActionName) > maxNameSize {
								maxNameSize = len(fullActionName)
							}
						}
					}
				}
			}
		}
	}
	return maxNameSize
}