-
Notifications
You must be signed in to change notification settings - Fork 137
Complete command line arguments #294
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
Changes from all commits
47319f8
43c3c93
3835106
c93d131
7d6916d
c2ec492
f956526
25da9ac
0206cb5
54527cf
d8b2adc
f902cf4
682de8a
3cff08d
16ad7d6
bf5e329
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
DATADIR="$(pkg-config --variable=datadir bash-completion)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should work if the |
||
|
||
# Exit if bash-completion isn't installed. | ||
if (( $? != 0 )) | ||
then | ||
exit 1 | ||
fi | ||
|
||
source "$DATADIR/bash-completion/bash_completion" | ||
|
||
COMP_LINE="$*" | ||
COMP_WORDS=("$@") | ||
COMP_CWORD="${#COMP_WORDS[@]}" | ||
((COMP_CWORD--)) | ||
COMP_POINT="${#COMP_LINE}" | ||
COMP_WORDBREAKS='"'"'><=;|&(:" | ||
|
||
_command_offset 0 2> /dev/null | ||
|
||
if (( ${#COMPREPLY[@]} == 0 )) | ||
then | ||
# Disabled by default because _longopt executes the program | ||
# to get its options. | ||
if (( ${BASH_LSP_COMPLETE_LONGOPTS} == 1 )) | ||
then | ||
_longopt "${COMP_WORDS[0]}" | ||
fi | ||
Comment on lines
+24
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, so we require people to set |
||
fi | ||
|
||
printf "%s\t" "${COMPREPLY[@]}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
grep - | ||
grep -- | ||
grep --line- |
Uh oh!
There was an error while loading. Please reload this page.