Skip to content

Commit

Permalink
exclude pac from plugin list if binary is in path
Browse files Browse the repository at this point in the history
Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel committed Jul 26, 2022
1 parent 9899873 commit ec5a5f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,3 @@ Only add 18mb :
% du tkno
138M tkno
```

### TODO
* avoid tkn-pac plugin showing up in the plugin section
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/openshift-pipelines/pipelines-as-code/pkg/cmd/tknpac"
"github.com/openshift-pipelines/pipelines-as-code/pkg/params"
"github.com/spf13/cobra"
"github.com/tektoncd/cli/pkg/cli"
"github.com/tektoncd/cli/pkg/cmd"
"github.com/tektoncd/cli/pkg/plugins"
Expand All @@ -29,9 +30,19 @@ func main() {
pac.Short = pacShortdesc
pac.Long = pacLongDesc
tkn.AddCommand(pac)
pluginList := plugins.GetAllTknPluginFromPaths()
newPluginList := []string{}
// remove pac from the plugin list
for _, value := range pluginList {
if value != "pac" {
newPluginList = append(newPluginList, value)
}
}
cobra.AddTemplateFunc("pluginList", func() []string { return newPluginList })

args := os.Args[1:]
cmd, _, _ := tkn.Find(args)

if cmd != nil && cmd == tkn && len(args) > 0 {
exCmd, err := plugins.FindPlugin(os.Args[1])
// if we can't find command then execute the normal tkn command.
Expand Down

0 comments on commit ec5a5f8

Please sign in to comment.