Skip to content

Commit

Permalink
Adding a bit more help text
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Wessendorf <[email protected]>
  • Loading branch information
matzew committed Nov 6, 2023
1 parent 810a003 commit 6dcacfc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
21 changes: 17 additions & 4 deletions cmd/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@ import (

func NewSubscribeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "subscribe",
Short: "Subscribe to a function",
Long: `Subscribe to a function`,
SuggestFor: []string{"subscribe", "subscribe"},
Use: "subscribe",
Short: "Subscribe a function to events",
Long: `Subscribe a function to events
Subscribe the function to a set of events, matching a set of filters for Cloud Event metadata
and a Knative Broker from where the events are consumed.
`,
Example: `
# Subscribe the function to the 'default' broker where events have 'type' of 'com.example'
and an 'extension' attribute for the value 'my-extension-value'.
{{rootCmdUse}} subscribe --filter type=com.example --filter extension=my-extension-value
# Subscribe the function to the 'my-broker' broker where events have 'type' of 'com.example'
and an 'extension' attribute for the value 'my-extension-value'.
{{rootCmdUse}} subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker
`,
SuggestFor: []string{"subcsribe", "subsrcibe"},

Check failure on line 30 in cmd/subscribe.go

View workflow job for this annotation

GitHub Actions / style / Golang / Lint

[github.com/client9/misspell] reported by reviewdog 🐶 "subsrcibe" is a misspelling of "subscribe" Raw Output: cmd/subscribe.go:30:37: "subsrcibe" is a misspelling of "subscribe"
PreRunE: bindEnv("filter", "source"),
RunE: func(cmd *cobra.Command, args []string) error {
return runSubscribe(cmd, args)
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/func.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Learn more about Knative at: https://knative.dev
* [func list](func_list.md) - List deployed functions
* [func repository](func_repository.md) - Manage installed template repositories
* [func run](func_run.md) - Run the function locally
* [func subscribe](func_subscribe.md) - Subscribe to a function
* [func subscribe](func_subscribe.md) - Subscribe a function to events
* [func templates](func_templates.md) - List available function source templates
* [func version](func_version.md) - Function client version information

22 changes: 20 additions & 2 deletions docs/reference/func_subscribe.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
## func subscribe

Subscribe to a function
Subscribe a function to events

### Synopsis

Subscribe to a function
Subscribe a function to events

Subscribe the function to a set of events, matching a set of filters for Cloud Event metadata
and a Knative Broker from where the events are consumed.


```
func subscribe
```

### Examples

```
# Subscribe the function to the 'default' broker where events have 'type' of 'com.example'
and an 'extension' attribute for the value 'my-extension-value'.
func subscribe --filter type=com.example --filter extension=my-extension-value
# Subscribe the function to the 'my-broker' broker where events have 'type' of 'com.example'
and an 'extension' attribute for the value 'my-extension-value'.
func subscribe --filter type=com.example --filter extension=my-extension-value --source my-broker
```

### Options

```
Expand Down

0 comments on commit 6dcacfc

Please sign in to comment.