Skip to content

Commit

Permalink
Print labels and annotations in describe command
Browse files Browse the repository at this point in the history
This commit prints labels and annotations in `faas-cli describe` command
whenever it is available.

Fixes: #533

Signed-off-by: Vivek Singh <[email protected]>
  • Loading branch information
viveksyngh authored and alexellis committed Oct 13, 2018
1 parent 517db31 commit 5a8b7e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions commands/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
2 changes: 2 additions & 0 deletions schema/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ type FunctionDescription struct {
EnvProcess string
URL string
AsyncURL string
Labels *map[string]string
Annotations *map[string]string
}

0 comments on commit 5a8b7e1

Please sign in to comment.