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.
This commit is contained in:
Yegor Yefremov 2023-04-19 01:49:09 +02:00 committed by GitHub
parent 6781a06a76
commit 3b72e31e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(