Skip to content

Commit 0a2c667

Browse files
committed
main: add --version=NONE option for printing the version number in simplified style
Close #2361. Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 94de29c commit 0a2c667

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

docs/man/ctags.1.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,14 @@ Miscellaneous Options
13271327
``-V``
13281328
Equivalent to ``--verbose``.
13291329

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

1336+
If ``NONE`` is given, prints the version identifier in a simplified way.
1337+
13361338
If *<language>* is given, print the version identifier for the parser
13371339
for *<language>*. See also the description for ``TAG_PARSER_VERSION`` in
13381340
:ref:`ctags-client-tools(7) <ctags-client-tools(7)>`.

main/options.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,6 +2687,14 @@ static void processVersionOption (
26872687
{
26882688
if (parameter == NULL || *parameter == '\0')
26892689
printProgramIdentification ();
2690+
else if (strcmp (parameter, RSV_NONE) == 0)
2691+
{
2692+
printf("ctags: %s\n", PROGRAM_VERSION);
2693+
if (! ((ctags_repoinfo == NULL)
2694+
|| (strcmp (ctags_repoinfo, PROGRAM_VERSION) == 0)))
2695+
printf("repoinfo: %s\n", ctags_repoinfo);
2696+
printf("output: %d.%d\n", OUTPUT_VERSION_CURRENT, OUTPUT_VERSION_AGE);
2697+
}
26902698
else
26912699
{
26922700
langType language = getNamedLanguage (parameter, 0);

man/ctags.1.rst.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,14 @@ Miscellaneous Options
13271327
``-V``
13281328
Equivalent to ``--verbose``.
13291329

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

1336+
If ``NONE`` is given, prints the version identifier in a simplified way.
1337+
13361338
If *<language>* is given, print the version identifier for the parser
13371339
for *<language>*. See also the description for ``TAG_PARSER_VERSION`` in
13381340
ctags-client-tools(7).

0 commit comments

Comments
 (0)