Syncthing added shell completion in v1.27.3-rc.1 (commit 78db3af8c5e8bd08a9773b0c4da233a52ed4cfe6). This change integrates that shell completion with Syncthing Tray's long existing completion (which only supports Bash so far).
13 lines
504 B
Bash
Executable File
13 lines
504 B
Bash
Executable File
_@META_TARGET_NAME@()
|
|
{
|
|
export COMP_LINE=${COMP_WORDS[@]} # for Syncthing's own completion which is invoked via `complete -C ...`
|
|
reply=$(@TARGET_EXECUTABLE@ --bash-completion-for "$((COMP_CWORD - 1))" "${COMP_WORDS[@]:1}")
|
|
if [[ $reply =~ COMPREPLY=.* ]]; then
|
|
eval "$reply" # for own completions which output `COMPREPLY=(...)`
|
|
else
|
|
COMPREPLY=($reply) # for Syncthing's own completion which outputs just the values
|
|
fi
|
|
return 0;
|
|
}
|
|
complete -F _@META_TARGET_NAME@ @META_TARGET_NAME@
|