diff --git a/src/main.vala b/src/main.vala index 2f790de..2c0ac94 100644 --- a/src/main.vala +++ b/src/main.vala @@ -17,9 +17,28 @@ * AUTHORS * Maciek Borzecki */ +private static bool log_debug = false; + +private const GLib.OptionEntry[] options = { + {"debug", 'd', 0, OptionArg.NONE, ref log_debug, "Show debug output", null}, + {null} +}; public static int main(string[] args) { + try { + var opt_context = new OptionContext ("mconnect"); + opt_context.set_help_enabled (true); + opt_context.add_main_entries (options, null); + opt_context.parse (ref args); + } catch (OptionError e) { + stdout.printf ("error: %s\n", e.message); + stdout.printf ("Run '%s --help' to see a full list of available command line options.\n", args[0]); + return 0; + } + + if (log_debug == true) + Environment.set_variable("G_MESSAGES_DEBUG", "all", false); Notify.init("mconnect"); var core = Core.instance();