diff --git a/doc/styleguide.txt b/doc/styleguide.txt index 629a60a021c..36487ac3684 100644 --- a/doc/styleguide.txt +++ b/doc/styleguide.txt @@ -61,22 +61,22 @@ 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 ------------------------------------------------- +`[[ ${COMPREPLY-} == *= ]] && compopt -o nospace` +------------------------------------------------- The above is functionally a shorthand for: ----- -if [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]]; then - compopt -o nospace -fi ----- + + 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. -$split && return ----------------- +`$split && return` +------------------ Should be used in completions using the -s flag of _init_completion, or other similar cases where _split_longopt has been invoked, after