Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/src/get-options.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

source /usr/share/bash-completion/bash_completion
DATADIR="$(pkg-config --variable=datadir bash-completion)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does the script handle if the user doesn't have the completion installed?

~ pkg-config --variable=datadir bash-completion

package bash-completion was not found in the pkg-config search path.
Perhaps you should add the directory containing `bash-completion.pc'
to the PKG_CONFIG_PATH environment variable
No package 'bash-completion' found

~ echo $?
1

Copy link
Collaborator

@skovhus skovhus Jul 4, 2021

Choose a reason for hiding this comment

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

At least on OS X the suggested solution doesn't work. Does the solution works on most Linux distributions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should work if the bash-completion package is installed and it provides a bash-completion.pc file.


source "$DATADIR/bash-completion/bash_completion"

COMP_LINE="$*"
COMP_WORDS=("$@")
Expand Down