Cobra: bash completion doesn't work correctly for alias of command

Created on 12 Nov 2017  路  2Comments  路  Source: spf13/cobra

bash completion generated by cobra does not work correctly for alias of command.

$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ source $(brew --prefix)/share/bash-completion/bash_completion
$ source <(hello completion)
$ alias h="hello"
$ complete -o default -F __start_hello h
$ h <tab>

Actual output:

$ h <tab>
hello

Expected output:

$ h <tab>
completion  say

https://github.com/superbrothers-sandbox/hello-cli/tree/autocomplete-alias reproduces this issue.

/ref https://github.com/kubernetes/kubectl/issues/120

are*sh completion kinbug

Most helpful comment

@nikhita Yes, this has been already fixed by https://github.com/spf13/cobra/pull/638. Thank you for letting me know.

All 2 comments

@superbrothers Looks like this can be closed and is fixed.

@nikhita Yes, this has been already fixed by https://github.com/spf13/cobra/pull/638. Thank you for letting me know.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjzcru picture jjzcru  路  3Comments

mdaymard picture mdaymard  路  5Comments

garthk picture garthk  路  3Comments

diwakergupta picture diwakergupta  路  5Comments

alapidas picture alapidas  路  3Comments