diff options
author | Raphaël Droz <raphael.droz+floss@gmail.com> | 2011-12-04 22:29:57 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2011-12-04 22:32:06 +0200 |
commit | f8b28a5827e1c2199f7a97c7d0b39f67a47975a8 (patch) | |
tree | 1bb798b38a6777b9492d34c5177b6906aec4fd8d | |
parent | 98fe4713a3f006b47f697307a68acde6150ca110 (diff) | |
download | bash-completion-f8b28a5827e1c2199f7a97c7d0b39f67a47975a8.tar.gz |
Added a word about compopt -o nospace in styleguide.txt.
Modified-by: Ville Skyttä <ville.skytta@iki.fi>
-rw-r--r-- | doc/styleguide.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/styleguide.txt b/doc/styleguide.txt index 0f7ec254..12b224f1 100644 --- a/doc/styleguide.txt +++ b/doc/styleguide.txt @@ -61,6 +61,20 @@ need that kind of processing (e.g. file and command names). The _filedir and _filedir_xspec helpers do this automatically whenever they return some completions. +[[ $COMPREPLY == *= ]] && compopt -o nospace +------------------------------------------------ + +The above is functionally a shorthand for: +---- +if [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]]; then + compopt -o nospace +fi +---- +It is used to ensure that long options' name won't get a space +appended after the equal sign. Calling compopt -o nospace makes sense +in case completion actually occurs: when only one completion is +available in COMPREPLY. + ///////////////////////////////////////// case/esac vs if --------------- |