Print labels and annotations in describe command

This commit prints labels and annotations in `faas-cli describe` command
whenever it is available.

Fixes: #533

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
This commit is contained in:
Vivek Singh
2018-10-03 20:16:44 +05:30
committed by Alex Ellis
parent 517db31170
commit 5a8b7e1fe4
2 changed files with 18 additions and 0 deletions

View File

@@ -96,6 +96,8 @@ func runDescribe(cmd *cobra.Command, args []string) error {
EnvProcess: function.EnvProcess,
URL: url,
AsyncURL: asyncURL,
Labels: function.Labels,
Annotations: function.Annotations,
}
printFunctionDescription(funcDesc)
@@ -119,5 +121,19 @@ func printFunctionDescription(funcDesc schema.FunctionDescription) {
fmt.Fprintln(w, "Function process:\t "+funcDesc.EnvProcess)
fmt.Fprintln(w, "URL:\t "+funcDesc.URL)
fmt.Fprintln(w, "Async URL:\t "+funcDesc.AsyncURL)
if funcDesc.Labels != nil {
fmt.Fprintf(w, "Labels:")
for key, value := range *funcDesc.Labels {
fmt.Fprintln(w, " \t "+key+" : "+value)
}
}
if funcDesc.Annotations != nil {
fmt.Fprintf(w, "Annotations:")
for key, value := range *funcDesc.Annotations {
fmt.Fprintln(w, " \t "+key+" : "+value)
}
}
w.Flush()
}

View File

@@ -14,4 +14,6 @@ type FunctionDescription struct {
EnvProcess string
URL string
AsyncURL string
Labels *map[string]string
Annotations *map[string]string
}