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:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -14,4 +14,6 @@ type FunctionDescription struct {
|
||||
EnvProcess string
|
||||
URL string
|
||||
AsyncURL string
|
||||
Labels *map[string]string
|
||||
Annotations *map[string]string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user