CodingGuidelines: give an example for shell function preamble
Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
9dbe780174
commit
6117a3d494
|
@ -123,9 +123,17 @@ For shell scripts specifically (not exhaustive):
|
||||||
- We do not write the noiseword "function" in front of shell
|
- We do not write the noiseword "function" in front of shell
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
- We prefer a space between the function name and the parentheses. The
|
- We prefer a space between the function name and the parentheses,
|
||||||
opening "{" should also be on the same line.
|
and no space inside the parentheses. The opening "{" should also
|
||||||
E.g.: my_function () {
|
be on the same line.
|
||||||
|
|
||||||
|
(incorrect)
|
||||||
|
my_function(){
|
||||||
|
...
|
||||||
|
|
||||||
|
(correct)
|
||||||
|
my_function () {
|
||||||
|
...
|
||||||
|
|
||||||
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
|
- As to use of grep, stick to a subset of BRE (namely, no \{m,n\},
|
||||||
[::], [==], or [..]) for portability.
|
[::], [==], or [..]) for portability.
|
||||||
|
|
Loading…
Reference in New Issue