From 0a2c667fda815cf3a43395bf91016cef93107bbe Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 14 Dec 2022 03:11:23 +0900 Subject: [PATCH] main: add --version=NONE option for printing the version number in simplified style Close #2361. Signed-off-by: Masatake YAMATO --- docs/man/ctags.1.rst | 4 +++- main/options.c | 8 ++++++++ man/ctags.1.rst.in | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/man/ctags.1.rst b/docs/man/ctags.1.rst index ba4e95772a..6bca79d3f3 100644 --- a/docs/man/ctags.1.rst +++ b/docs/man/ctags.1.rst @@ -1327,12 +1327,14 @@ Miscellaneous Options ``-V`` Equivalent to ``--verbose``. -``--version[=]`` +``--version[=|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) `. + If ``NONE`` is given, prints the version identifier in a simplified way. + If ** is given, print the version identifier for the parser for **. See also the description for ``TAG_PARSER_VERSION`` in :ref:`ctags-client-tools(7) `. diff --git a/main/options.c b/main/options.c index 06f45bffcd..b00a707773 100644 --- a/main/options.c +++ b/main/options.c @@ -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); diff --git a/man/ctags.1.rst.in b/man/ctags.1.rst.in index 8e72cca9e9..36d2839deb 100644 --- a/man/ctags.1.rst.in +++ b/man/ctags.1.rst.in @@ -1327,12 +1327,14 @@ Miscellaneous Options ``-V`` Equivalent to ``--verbose``. -``--version[=]`` +``--version[=|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 ** is given, print the version identifier for the parser for **. See also the description for ``TAG_PARSER_VERSION`` in ctags-client-tools(7).