Bash completion for the faas alias is not working
After installing faas-cli, a bash alias faas is also created by creating a symbolic link according to the PR https://github.com/openfaas/faas-cli/pull/234
Bash completion does not work for the alias faas though, which forces you to resort to using faas-cli
Expected Behaviour
Bash completion works for both faas-cli and faas
Current Behaviour
Bash completion does not work for the alias faas.
Possible Solution
There is a helpful guide in the cobra repo:
https://github.com/spf13/cobra/blob/master/bash_completions.md#using-bash-aliases-for-commands
Creating a file under /etc/bash_completion.d/faas on Linux with the content below would fix this:
complete -o default -F __start_faas-cli faas
The completion works after sourcing that file
$ source /etc/bash_completion.d/faas
$ faas
auth deploy list namespaces secret version
build describe login new store
cloud generate logout push template
completion invoke logs remove up
But that's just something I have tested quickly on Linux.
Steps to Reproduce (for bugs)
- Install
faas-cli - Try auto-complete with
faaswith Tab
Context
Creating the faas alias without bash completion makes the alias not very useful as it makes you resort to faas-cli most of the time to get completion for the commands.
Your Environment
- FaaS-CLI version ( Full output from:
faas-cli version):
faas-cli version
___ _____ ____
/ _ \ _ __ ___ _ __ | ___|_ _ __ _/ ___|
| | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
| |_| | |_) | __/ | | | _| (_| | (_| |___) |
\___/| .__/ \___|_| |_|_| \__,_|\__,_|____/
|_|
CLI:
commit: 2d183c713b32385831dc7f69c073e57c06e3b76c
version: 0.12.2
- Docker version ( Full output from:
docker version):
docker version
Client:
Version: 19.03.6
API version: 1.40
Go version: go1.12.17
Git commit: 369ce74a3c
Built: Fri Feb 28 23:45:43 2020
OS/Arch: linux/amd64
Experimental: true
Server:
Engine:
Version: 19.03.6
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: 369ce74a3c
Built: Wed Feb 19 01:06:16 2020
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.3.3-0ubuntu1~18.04.2
GitCommit:
runc:
Version: spec: 1.0.1-dev
GitCommit:
docker-init:
Version: 0.18.0
GitCommit:
- Operating System and version (e.g. Linux, Windows, MacOS): Linux Ubuntu 18.04