openfaas / openfaas/faas-cli

Bash completion for the faas alias is not working

Open
#791 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
816
Forks
230
Avg merge
6h 4m
Merged PRs (30d)
1

Description

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)

  1. Install faas-cli
  2. Try auto-complete with faas with 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the bash-alias guidance linked in the issue and the change from PR #234 that creates the faas symlink. Reproduce the completion behavior on Linux Ubuntu 18.04, then verify that sourcing the installed completion setup provides the same command completion for both faas-cli and faas.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.