Skip to content
Myr

completions: style improvements for fish completion function

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- loop not necessary, set variable already works as expected - ending lines with ; is not idiomatic

authored by exploide · committed by David Lord · parent a825ebd · Browse files · 1 file+15 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−19 removed

  • other:+15 added−19 removed

1 file+15 added−19 removed

modified:src/click/shell_completion.py+15 added-19 removed
159 unmodified lines
160compdef %(complete_func)s %(prog_name)s;161"""162163_SOURCE_FISH = """\164function %(complete_func)s;165 set -l response;164function %(complete_func)s165 set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \166COMP_CWORD=(commandline -t) %(prog_name)s)167167 for value in (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \168COMP_CWORD=(commandline -t) %(prog_name)s);169 set response $response $value;170 end;168 for completion in $response169 set -l metadata (string split "," $completion)170172 for completion in $response;173 set -l metadata (string split "," $completion);171 if test $metadata[1] = "dir"172 __fish_complete_directories $metadata[2]173 else if test $metadata[1] = "file"174 __fish_complete_path $metadata[2]175 else if test $metadata[1] = "plain"176 echo $metadata[2]177 end178 end179end180175 if test $metadata[1] = "dir";176 __fish_complete_directories $metadata[2];177 else if test $metadata[1] = "file";178 __fish_complete_path $metadata[2];179 else if test $metadata[1] = "plain";180 echo $metadata[2];181 end;182 end;183end;184181complete --no-files --command %(prog_name)s --arguments \186"(%(complete_func)s)";182"(%(complete_func)s)"183"""184185186class ShellComplete:
400 unmodified lines