Skip to content

Commit

Permalink
Fix bash completion
Browse files Browse the repository at this point in the history
Signed-off-by: Chmouel Boudjnah <[email protected]>
  • Loading branch information
chmouel authored and tekton-robot committed Aug 22, 2019
1 parent 1df94bb commit edcee68
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/cmd/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@ function __tkn_get_object() {
fi
}
function __kubectl_get_namespace() { __tkn_get_object namespace kubectl}
function __kubectl_get_serviceaccount() { __tkn_get_object serviceaccount kubectl}
function __tkn_get_pipeline() { __tkn_get_object pipeline tkn }
function __tkn_get_pipelinerun() { __tkn_get_object pipelinerun tkn }
function __tkn_get_taskrun() { __tkn_get_object taskrun tkn}
function __tkn_get_pipelineresource() { __tkn_get_object pipelineresource tkn}
function __kubectl_get_namespace() { __tkn_get_object namespace kubectl ;}
function __kubectl_get_serviceaccount() { __tkn_get_object serviceaccount kubectl ;}
function __tkn_get_pipeline() { __tkn_get_object pipeline tkn ;}
function __tkn_get_pipelinerun() { __tkn_get_object pipelinerun tkn ;}
function __tkn_get_taskrun() { __tkn_get_object taskrun tkn ;}
function __tkn_get_pipelineresource() { __tkn_get_object pipelineresource tkn ;}
`
bashCompletion = `
function __custom_func() {
case ${last_command} in
*_describe|*_logs)
*_start|*_describe|*_logs)
obj=${last_command/tkn_/};
obj=${obj/_describe/}; obj=${obj/_logs/};
__tkn_get_object ${obj}
obj=${obj/_describe/}; obj=${obj/_logs/};obj=${obj/_start/};
__tkn_get_object ${obj} tkn
return
;;
*)
Expand All @@ -104,7 +104,7 @@ func Command() *cobra.Command {
if len(args) == 1 {
switch args[0] {
case "bash":
return cmd.Root().GenBashCompletion(os.Stdout)
return runCompletionBash(os.Stdout, cmd.Parent())
case "zsh":
return runCompletionZsh(os.Stdout, cmd.Parent())
}
Expand Down

0 comments on commit edcee68

Please sign in to comment.