40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
Coding Style Guide
|
|
==================
|
|
|
|
Introduction
|
|
------------
|
|
This document attempts to explain the basic styles and patterns that are used in the bash completion. New code should try to conform to these standards so that it is as easy to maintain as existing code. Of course every rule has an exception, but it's important to know the rules nonetheless!
|
|
|
|
This is particularly directed at people new to the bash completion codebase, who are in the process of getting their code reviewed. Before getting a review, please read over this document and make sure your code conforms to the recommendations here.
|
|
|
|
Indentation
|
|
-----------
|
|
Indent step should be 4 spaces, no tabs.
|
|
|
|
/////////////////////////////////////////
|
|
case/esac vs if
|
|
---------------
|
|
|
|
simple matching vs extended globbing
|
|
------------------------------------
|
|
in case statements: -@(a|b)) vs -a|-b)
|
|
|
|
testing with [[ ]] vs [ ]
|
|
-------------------------
|
|
|
|
line wrapping
|
|
-------------
|
|
|
|
quoting
|
|
-------
|
|
|
|
awk vs cut for simple cases
|
|
---------------------------
|
|
|
|
$(...) vs `...`
|
|
---------------
|
|
|
|
variable and function naming
|
|
----------------------------
|
|
/////////////////////////////////////////
|