명령 요약을 작성하는 표준이 있나요?

명령 요약을 작성하는 표준이 있나요?

제 생각에는 모든 사람이 기사를 작성하는 방법에 대한 자신의 생각을 가지고 있습니다.요약설명하다명령 사용법최종 사용자용.

예를 들어 다음과 같은 형식입니다 man grep.

grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]

이제 다른 맨페이지에 나타나는 일부 구문이 있습니다. []선택 사항으로 간주되며 ...동일한 입력의 배수로만 의미가 있습니다.

그러나 사람들은 OR 대신 |or를 사용하고, 다른 사람들은 의미를 반대로 사용합니다. 아니면 어디로 가야할지 아무런 지시도 하지 않았습니다 . /[][OPTIONS]

나는 내가 쓰는 글의 표준을 따르고 싶지만 내가 보는 사이트마다 다른 내용이 나와 있습니다.

실제 있는게 있나요?기준시놉시스를 쓰는 방식인가요, 아니면 관습은 사람들이 오랫동안 해왔던 방식인가요?

답변1

고전적인 표준은 POSIX에서 나왔습니다.유틸리티 매개변수 구문(업데이트된 링크를 제공해 주신 @illuminÉ에게 감사드립니다). 매뉴얼 페이지에서 사용되는 구문을 설명합니다.

utility_name[-a][-b][-c option_argument]
    [-d|-e][-f[option_argument]][operand...]

전통적으로 단일 문자 옵션 사용을 권장하고 -W이를 공급업체에 권장합니다. 이는 다중 문자 옵션이 적용되는 방식입니다(예를 참조하세요).gcc 옵션 요약).

GNU 소프트웨어는 --.help2man 참조.

답변2

SYNOPSIS사실, 에서 (놀랍게도!) 찾아보면 답을 찾을 수 있습니다 . man 7 man-pages그것은 말한다:

       SYNOPSIS      A brief summary of the command or function's interface.

                     For commands, this shows the syntax of  the  command  and
                     its  arguments  (including options); boldface is used for
                     as-is text and italics are used to  indicate  replaceable
                     arguments.   Brackets  ([])  surround optional arguments,
                     vertical bars (|) separate choices,  and  ellipses  (...)
                     can  be  repeated.   For functions, it shows any required
                     data declarations or #include directives, followed by the
                     function declaration.

                     Where  a  feature  test macro must be defined in order to
                     obtain the declaration of a function (or a variable) from
                     a header file, then the SYNOPSIS should indicate this, as
                     described in feature_test_macros(7).

관련 정보