Skip to content

[Fish completion] Enrich description for container/image candidates #1623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tmshn
Copy link

@tmshn tmshn commented Jan 19, 2019

- What I did

For container/image candidates of fish completion, enriched description to include more info rather than just showing "Container" or "Image"

before

after

- How I did it

On fish completion, description can be added not only by -d option of complete command, but also by appending tab-separeted field for each candidate line.

each argument may optionally have a tab character followed by the argument description

ref: man complete https://fishshell.com/docs/current/commands.html#complete

So I fixed the functions __fish_print_docker_containers and __fish_print_docker_images to include information of candidates, and remove -d option.

- How to verify it

  1. Install fish
  2. Install this completion
    • Just put this docker.fish file under ~/.config/fish/completions/
  3. Try completion
    • E.g: docker run TAB or docker stop TAB etc

- Description for the changelog

cli fish completion: enriched containers/images description

- A picture of a cute animal (not mandatory but encouraged)

tiger

Photo by @africansafari1, a zoo in Japan

tmshn added 2 commits January 19, 2019 20:07
Signed-off-by: Shinichi TAMURA <shnch.tmr@gmail.com>
Signed-off-by: Shinichi TAMURA <shnch.tmr@gmail.com>
@codecov-io
Copy link

Codecov Report

Merging #1623 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1623   +/-   ##
=======================================
  Coverage   55.16%   55.16%           
=======================================
  Files         301      301           
  Lines       20384    20384           
=======================================
  Hits        11244    11244           
  Misses       8335     8335           
  Partials      805      805

@@ -26,12 +26,14 @@ end
function __fish_print_docker_containers --description 'Print a list of docker containers' -a select
switch $select

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great; just one nitpick: there should be a set -l filter here to declare filter as local variable, otherwise we might use a global variable with the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants