dubeejw commented on a change in pull request #2424: (Review) Leading Slash 
(CLI issue #2328)
URL: 
https://github.com/apache/incubator-openwhisk/pull/2424#discussion_r127467810
 
 

 ##########
 File path: tools/cli/go-whisk-cli/commands/qualifiedname.go
 ##########
 @@ -0,0 +1,207 @@
+/*
+ * Copyright 2015-2016 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package commands
+
+import (
+    "errors"
+    "fmt"
+    "strings"
+    "../../go-whisk/whisk"
+    "../wski18n"
+)
+
+type QualifiedName struct {
+    namespace   string  // namespace. does not include leading '/'.  may be "" 
(i.e. default namespace)
+    packageName string  // package.  may be "".  does not include 
leading/trailing '/'
+    entity      string  // entity.  should not be ""
+    entityName  string  // pkg+entity
+}
+
+//  GetFullQualifiedName() returns a full qualified name in proper string 
format
+//      from qualifiedName with proper syntax.
+//  Example: /namespace/[package/]entity
+func (qualifiedName *QualifiedName) GetFullQualifiedName() string {
+    output := []string{}
+
+    if len(qualifiedName.namespace) > 0 {
+        output = append(output, "/", qualifiedName.namespace, "/")
+    }
+    if len(qualifiedName.packageName) > 0 {
+        output = append(output, qualifiedName.packageName, "/")
+    }
+    output = append(output, qualifiedName.entity)
+
+    return strings.Join(output, "")
+}
+
+//  GetPackageName() returns the package name from qualifiedName without a
+//      leading '/'
+func (qualifiedName *QualifiedName) GetPackageName() string {
+    return qualifiedName.packageName
+}
+
+//  GetEntityName() returns the entity name ([package/]entity) of qualifiedName
+//      without a leading '/'
+func (qualifiedName *QualifiedName) GetEntityName() string {
+    return qualifiedName.entityName
+}
+
+//  GetEntity() returns the name of entity in qualifiedName without a leading 
'/'
+func (qualifiedName *QualifiedName) GetEntity() string {
+    return qualifiedName.entity
+}
+
+//  GetNamespaceFromQN() returns the name of the namespace in qualifiedName 
without
+//      a leading '/'
+func (qualifiedName *QualifiedName) GetNamespaceFromQN() string {
 
 Review comment:
   I think you can drop `FromQN` since it isn't in the other function names. 
Since the type is a `QualifiedName` we can assume we can assume the from aspect.
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to