Added a word about compopt -o nospace in styleguide.txt.
Modified-by: Ville Skyttä <ville.skytta@iki.fi>
This commit is contained in:
parent
98fe4713a3
commit
f8b28a5827
@ -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
|
_filedir and _filedir_xspec helpers do this automatically whenever
|
||||||
they return some completions.
|
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
|
case/esac vs if
|
||||||
---------------
|
---------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user