func getLargestApiNameSize()

in commands/api.go [768:792]


func getLargestApiNameSize(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
		apiName := resultApi.Swagger.Info.Title
		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)
							if len(apiName) > maxNameSize {
								maxNameSize = len(apiName)
							}
						}
					}
				}
			}
		}
	}
	return maxNameSize
}