From 3b72e31e5daa211127d09532e013750684c9f306 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Wed, 19 Apr 2023 01:49:09 +0200 Subject: [PATCH] Console: add --version option (#175) This option prints application name and its version. Such an output can be used to automatically generate a man page using the help2man utility. --- src/Console/AppConsole.vala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Console/AppConsole.vala b/src/Console/AppConsole.vala index e4c726c..0f5c697 100644 --- a/src/Console/AppConsole.vala +++ b/src/Console/AppConsole.vala @@ -63,6 +63,11 @@ public class AppConsole : GLib.Object { case "-h": stdout.printf (help_message ()); return 0; + + case "--version": + stdout.printf (version_message ()); + return 0; + } } else if (args.length == 1){ @@ -334,6 +339,11 @@ public class AppConsole : GLib.Object { } } + private static string version_message (){ + string msg = "%s %s\n".printf( AppName, AppVersion); + return msg; + } + private static string help_message (){ string msg = "\n%s v%s by Tony George (%s)\n".printf(