]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Short version string output
authorTobias Hieta <tobias@plex.tv>
Mon, 8 Jun 2020 12:06:37 +0000 (14:06 +0200)
committerTobias Hieta <tobias@plex.tv>
Tue, 9 Jun 2020 06:40:41 +0000 (08:40 +0200)
This adds support for just showing the version string
without the full welcome message if the log level is
less than the default. That means that you pass -q once
and you will just see "1.4.5".

This makes it easier to parse in scripts.

programs/zstdcli.c

index 70e2b70666bf265e074da8022576d072f85cf438..6b795bb68ac94ba674d113108409253b71bf0fce 100644 (file)
@@ -544,6 +544,11 @@ static unsigned parseCompressionParameters(const char* stringPtr, ZSTD_compressi
 
 static void printVersion(void)
 {
+    if (g_displayLevel < DISPLAY_LEVEL_DEFAULT) {
+        DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
+        return;
+    }
+
     DISPLAYOUT(WELCOME_MESSAGE);
     if (g_displayLevel >= 3) {
     /* format support */