mirror of
https://github.com/alexkay/spek.git
synced 2025-04-20 18:37:36 +03:00
Parse command line options, print version info
This commit is contained in:
parent
3b48f7cbe2
commit
c32bcadde1
@ -18,12 +18,32 @@
|
||||
|
||||
using Spek;
|
||||
|
||||
bool version = false;
|
||||
// TODO: move into main() when bgo#530623 is fixed.
|
||||
const OptionEntry[] options = {
|
||||
{ "version", 'V', 0, OptionArg.NONE, &version, N_("Display the version and exit"), null },
|
||||
{ null }
|
||||
};
|
||||
|
||||
int main (string[] args) {
|
||||
Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
|
||||
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
|
||||
Intl.textdomain (Config.GETTEXT_PACKAGE);
|
||||
|
||||
Gtk.init (ref args);
|
||||
try {
|
||||
Gtk.init_with_args (ref args, _("[FILE]"), (OptionEntry[]) options, Config.GETTEXT_PACKAGE);
|
||||
} catch (Error e) {
|
||||
print (e.message);
|
||||
print ("\n");
|
||||
print (_("Run `%s --help` to see a full list of available command line options.\n"), args[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (version) {
|
||||
print (_("%s version %s\n"), Config.PACKAGE_NAME, Config.PACKAGE_VERSION);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Gst.init (ref args);
|
||||
var window = new Window ();
|
||||
Gtk.main ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user