Skip to content

Commit

Permalink
main: add --version=NONE option for printing the version number in si…
Browse files Browse the repository at this point in the history
…mplified style

Close #2361.

Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Dec 14, 2022
1 parent 94de29c commit 0a2c667
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/man/ctags.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,14 @@ Miscellaneous Options
``-V``
Equivalent to ``--verbose``.

``--version[=<language>]``
``--version[=<language>|NONE]``
Prints a version identifier for ctags to standard
output, and then exits. This is guaranteed to always contain the string
"Universal Ctags". See also the description for ``TAG_PROGRAM_VERSION``
and ``TAG_OUTPUT_VERSION`` in :ref:`ctags-client-tools(7) <ctags-client-tools(7)>`.

If ``NONE`` is given, prints the version identifier in a simplified way.

If *<language>* is given, print the version identifier for the parser
for *<language>*. See also the description for ``TAG_PARSER_VERSION`` in
:ref:`ctags-client-tools(7) <ctags-client-tools(7)>`.
Expand Down
8 changes: 8 additions & 0 deletions main/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -2687,6 +2687,14 @@ static void processVersionOption (
{
if (parameter == NULL || *parameter == '\0')
printProgramIdentification ();
else if (strcmp (parameter, RSV_NONE) == 0)
{
printf("ctags: %s\n", PROGRAM_VERSION);
if (! ((ctags_repoinfo == NULL)
|| (strcmp (ctags_repoinfo, PROGRAM_VERSION) == 0)))
printf("repoinfo: %s\n", ctags_repoinfo);
printf("output: %d.%d\n", OUTPUT_VERSION_CURRENT, OUTPUT_VERSION_AGE);
}
else
{
langType language = getNamedLanguage (parameter, 0);
Expand Down
4 changes: 3 additions & 1 deletion man/ctags.1.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -1327,12 +1327,14 @@ Miscellaneous Options
``-V``
Equivalent to ``--verbose``.

``--version[=<language>]``
``--version[=<language>|NONE]``
Prints a version identifier for @CTAGS_NAME_EXECUTABLE@ to standard
output, and then exits. This is guaranteed to always contain the string
"Universal Ctags". See also the description for ``TAG_PROGRAM_VERSION``
and ``TAG_OUTPUT_VERSION`` in ctags-client-tools(7).

If ``NONE`` is given, prints the version identifier in a simplified way.

If *<language>* is given, print the version identifier for the parser
for *<language>*. See also the description for ``TAG_PARSER_VERSION`` in
ctags-client-tools(7).
Expand Down

0 comments on commit 0a2c667

Please sign in to comment.