Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eventlistener list #551

Merged
merged 1 commit into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ The following commands help you understand and effectively use the Tekton CLI:
* [`tkn clustertask:`](docs/cmd/tkn_clustertask.md) Parent command of the ClusterTask command group.
* [`tkn completion:`](docs/cmd/tkn_completion.md) Outputs a BASH or ZSH completion script for `tkn` to allow command completion with Tab.
* [`tkn condition:`](docs/cmd/tkn_condition.md) Parent command of the Condition command group.
* [`tkn eventlistener:`](docs/cmd/tkn_eventlistener.md) Parent command of the Eventlistener command group.
* [`tkn pipeline:`](docs/cmd/tkn_pipeline.md) Parent command of the Pipeline command group.
* [`tkn pipelinerun:`](docs/cmd/tkn_pipelinerun.md) Parent command of the Pipelinerun command group.
* [`tkn resource:`](docs/cmd/tkn_resource.md) Parent command of the Resource command group.
Expand Down
1 change: 1 addition & 0 deletions docs/cmd/tkn.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CLI for tekton pipelines
* [tkn clustertask](tkn_clustertask.md) - Manage clustertasks
* [tkn completion](tkn_completion.md) - Prints shell completion scripts
* [tkn condition](tkn_condition.md) - Manage conditions
* [tkn eventlistener](tkn_eventlistener.md) - Manage eventlisteners
* [tkn pipeline](tkn_pipeline.md) - Manage pipelines
* [tkn pipelinerun](tkn_pipelinerun.md) - Manage pipelineruns
* [tkn resource](tkn_resource.md) - Manage pipeline resources
Expand Down
25 changes: 25 additions & 0 deletions docs/cmd/tkn_eventlistener.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## tkn eventlistener

Manage eventlisteners

***Aliases**: el,eventlisteners*

### Synopsis

Manage eventlisteners

### Options

```
-c, --context string name of the kubeconfig context to use (default: kubectl config current-context)
-h, --help help for eventlistener
-k, --kubeconfig string kubectl config file (default: $HOME/.kube/config)
-n, --namespace string namespace to use (default: from $KUBECONFIG)
-C, --nocolour disable colouring (default: false)
```

### SEE ALSO

* [tkn](tkn.md) - CLI for tekton pipelines
* [tkn eventlistener list](tkn_eventlistener_list.md) - Lists eventlisteners in a namespace

49 changes: 49 additions & 0 deletions docs/cmd/tkn_eventlistener_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
## tkn eventlistener list

Lists eventlisteners in a namespace

***Aliases**: ls*

### Usage

```
tkn eventlistener list
```

### Synopsis

Lists eventlisteners in a namespace

### Examples

List all eventlisteners in namespace 'bar':

tkn eventlistener list -n bar

or

tkn el ls -n bar


### Options

```
--allow-missing-template-keys If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
-h, --help help for list
-o, --output string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
--template string Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
```

### Options inherited from parent commands

```
-c, --context string name of the kubeconfig context to use (default: kubectl config current-context)
-k, --kubeconfig string kubectl config file (default: $HOME/.kube/config)
-n, --namespace string namespace to use (default: from $KUBECONFIG)
-C, --nocolour disable colouring (default: false)
```

### SEE ALSO

* [tkn eventlistener](tkn_eventlistener.md) - Manage eventlisteners

86 changes: 86 additions & 0 deletions docs/man/man1/tkn-eventlistener-list.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.TH "TKN\-EVENTLISTENER\-LIST" "1" "" "Auto generated by spf13/cobra" ""
.nh
.ad l


.SH NAME
.PP
tkn\-eventlistener\-list \- Lists eventlisteners in a namespace


.SH SYNOPSIS
.PP
\fBtkn eventlistener list\fP


.SH DESCRIPTION
.PP
Lists eventlisteners in a namespace


.SH OPTIONS
.PP
\fB\-\-allow\-missing\-template\-keys\fP[=true]
If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for list

.PP
\fB\-o\fP, \fB\-\-output\fP=""
Output format. One of: json|yaml|name|go\-template|go\-template\-file|template|templatefile|jsonpath|jsonpath\-file.

.PP
\fB\-\-template\fP=""
Template string or path to template file to use when \-o=go\-template, \-o=go\-template\-file. The template format is golang templates [
\[la]http://golang.org/pkg/text/template/#pkg-overview\[ra]].


.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB\-c\fP, \fB\-\-context\fP=""
name of the kubeconfig context to use (default: kubectl config current\-context)

.PP
\fB\-k\fP, \fB\-\-kubeconfig\fP=""
kubectl config file (default: $HOME/.kube/config)

.PP
\fB\-n\fP, \fB\-\-namespace\fP=""
namespace to use (default: from $KUBECONFIG)

.PP
\fB\-C\fP, \fB\-\-nocolour\fP[=false]
disable colouring (default: false)


.SH EXAMPLE
.PP
List all eventlisteners in namespace 'bar':

.PP
.RS

.nf
tkn eventlistener list \-n bar

.fi
.RE

.PP
or

.PP
.RS

.nf
tkn el ls \-n bar

.fi
.RE


.SH SEE ALSO
.PP
\fBtkn\-eventlistener(1)\fP
45 changes: 45 additions & 0 deletions docs/man/man1/tkn-eventlistener.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.TH "TKN\-EVENTLISTENER" "1" "" "Auto generated by spf13/cobra" ""
.nh
.ad l


.SH NAME
.PP
tkn\-eventlistener \- Manage eventlisteners


.SH SYNOPSIS
.PP
\fBtkn eventlistener\fP


.SH DESCRIPTION
.PP
Manage eventlisteners


.SH OPTIONS
.PP
\fB\-c\fP, \fB\-\-context\fP=""
name of the kubeconfig context to use (default: kubectl config current\-context)

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
help for eventlistener

.PP
\fB\-k\fP, \fB\-\-kubeconfig\fP=""
kubectl config file (default: $HOME/.kube/config)

.PP
\fB\-n\fP, \fB\-\-namespace\fP=""
namespace to use (default: from $KUBECONFIG)

.PP
\fB\-C\fP, \fB\-\-nocolour\fP[=false]
disable colouring (default: false)


.SH SEE ALSO
.PP
\fBtkn(1)\fP, \fBtkn\-eventlistener\-list(1)\fP
2 changes: 1 addition & 1 deletion docs/man/man1/tkn.1
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ CLI for tekton pipelines

.SH SEE ALSO
.PP
\fBtkn\-clustertask(1)\fP, \fBtkn\-completion(1)\fP, \fBtkn\-condition(1)\fP, \fBtkn\-pipeline(1)\fP, \fBtkn\-pipelinerun(1)\fP, \fBtkn\-resource(1)\fP, \fBtkn\-task(1)\fP, \fBtkn\-taskrun(1)\fP, \fBtkn\-triggerbinding(1)\fP, \fBtkn\-triggertemplate(1)\fP, \fBtkn\-version(1)\fP
\fBtkn\-clustertask(1)\fP, \fBtkn\-completion(1)\fP, \fBtkn\-condition(1)\fP, \fBtkn\-eventlistener(1)\fP, \fBtkn\-pipeline(1)\fP, \fBtkn\-pipelinerun(1)\fP, \fBtkn\-resource(1)\fP, \fBtkn\-task(1)\fP, \fBtkn\-taskrun(1)\fP, \fBtkn\-triggerbinding(1)\fP, \fBtkn\-triggertemplate(1)\fP, \fBtkn\-version(1)\fP
42 changes: 42 additions & 0 deletions pkg/cmd/eventlistener/eventlistener.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright © 2019 The Tekton Authors.
//
// 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 eventlistener

import (
"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
"github.com/tektoncd/cli/pkg/flags"
)

func Command(p cli.Params) *cobra.Command {
cmd := &cobra.Command{
Use: "eventlistener",
Aliases: []string{"el", "eventlisteners"},
Short: "Manage eventlisteners",
Annotations: map[string]string{
"commandType": "main",
},
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return flags.InitParams(p, cmd)
},
}

flags.AddTektonOptions(cmd)
cmd.AddCommand(
listCommand(p),
)

return cmd
}
30 changes: 30 additions & 0 deletions pkg/cmd/eventlistener/eventlistener_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright © 2019 The Tekton Authors.
//
// 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 eventlistener

import (
"testing"

"github.com/tektoncd/cli/pkg/test"
)

func TestEventListener_invalid(t *testing.T) {
p := &test.Params{}
el := Command(p)
out, err := test.ExecuteCommand(el, "foobar")
if err == nil {
t.Errorf("No errors was defined. Output: %s", out)
}
}
Loading