From: Ævar Arnfjörð Bjarmason Date: Thu, 13 Oct 2022 15:38:56 +0000 (+0200) Subject: CodingGuidelines: update and clarify command-line conventions X-Git-Tag: v2.39.0-rc0~73^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6584fcc5c8ed2ed7e0785bcda3513a4bedb017ce;p=thirdparty%2Fgit.git CodingGuidelines: update and clarify command-line conventions Edit the section which explains how to create a good SYNOPSIS section for clarity and accuracy, it was mostly introduced in c455bd8950e (CodingGuidelines: Add a section on writing documentation, 2010-11-04): * Change "extra" example to "file", which now naturally follows from previous "..." example (one or more) to "[...]" (zero or more). * Explain how we prefer spacing around "[]()" tokens and "|" alternatives, this is not a new policy, but just codifies what's already the pattern in the most wide use in the documentation. Having a space around " | " for flags, but not for flag values is inconsistent, but this style guide codifies existing patterns. Grepping shows that we don't have any instance matching the second "Don't" example: git grep -E -h -o '=\([^)]+\)' -- builtin Documentation/ Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 4c756be517..b5a85d0cd4 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -650,8 +650,8 @@ Writing Documentation: (One or more of .) Optional parts are enclosed in square brackets: - [] - (Zero or one .) + [...] + (Zero or more of .) --exec-path[=] (Option with an optional argument. Note that the "=" is inside the @@ -665,6 +665,16 @@ Writing Documentation: [-q | --quiet] [--utf8 | --no-utf8] + Use spacing around "|" token(s), but not immediately after opening or + before closing a [] or () pair: + Do: [-q | --quiet] + Don't: [-q|--quiet] + + Don't use spacing around "|" tokens when they're used to seperate the + alternate arguments of an option: + Do: --track[=(direct|inherit)] + Don't: --track[=(direct | inherit)] + Parentheses are used for grouping: [( | )...] (Any number of either or . Parens are needed to make