dubeejw commented on a change in pull request #2326: Alphabetize listings in CLI
URL: 
https://github.com/apache/incubator-openwhisk/pull/2326#discussion_r132262039
 
 

 ##########
 File path: tools/cli/go-whisk/whisk/namespace.go
 ##########
 @@ -39,6 +42,35 @@ type NamespaceService struct {
     client *Client
 }
 
+// Compare(sortable) compares namespace to sortable for the purpose of sorting.
+// REQUIRED: sortable must also be of type Namespace.
+// ***Method of type Sortable***
+func(namespace Namespace) Compare(sortable Sortable) (bool) {
+    // Sorts alphabetically
+    namespaceToCompare := sortable.(Namespace)
+    var namespaceString string
+    var compareString string
+
+    namespaceString = strings.ToLower(namespace.Name)
+    compareString = strings.ToLower(namespaceToCompare.Name)
+
+    return namespaceString < compareString
+}
+
+// ToHeaderString() returns the header for a list of namespaces
+func(namespace Namespace) ToHeaderString() string {
+    var boldString = color.New(color.Bold).SprintFunc()
+
+    return fmt.Sprintf("%s\n", boldString("namespaces"))
 
 Review comment:
   The above applies to all the `ToHeaderString()` methods.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to