[polari] main: Make gjs' debugger console available via command line



commit 36c881b858f4487a9aead4b3419b5bad333293d7
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jul 12 23:53:24 2018 +0200

    main: Make gjs' debugger console available via command line
    
    GJS added support for a simple debug console, but as we are using
    a dedicated binary instead of gjs-console, we need to hook up the
    support ourselves.
    
    https://gitlab.gnome.org/GNOME/polari/merge_requests/49

 src/polari.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/polari.c b/src/polari.c
index 0155cdb..066680f 100644
--- a/src/polari.c
+++ b/src/polari.c
@@ -13,16 +13,33 @@ int
 main (int argc, char *argv[])
 {
   const char *search_path[] = { "resource:///org/gnome/Polari/js", NULL };
+  g_autoptr (GOptionContext) option_context = NULL;
   g_autoptr (GError) error = NULL;
   g_autoptr (GjsContext) context = NULL;
+  gboolean debugger = FALSE;
   int status;
 
+  GOptionEntry entries[] =
+    {
+      { "debugger", 'd', 0, G_OPTION_ARG_NONE, &debugger, NULL, NULL }
+    };
+
   g_irepository_prepend_search_path (PKGLIBDIR);
 
   context = g_object_new (GJS_TYPE_CONTEXT,
                           "search-path", search_path,
                           NULL);
 
+  option_context = g_option_context_new ("");
+  g_option_context_set_help_enabled (option_context, FALSE);
+  g_option_context_set_ignore_unknown_options (option_context, TRUE);
+  g_option_context_add_main_entries (option_context, entries, NULL);
+
+  g_option_context_parse (option_context, &argc, &argv, NULL);
+
+  if (debugger)
+    gjs_context_setup_debugger_console (context);
+
   if (!gjs_context_define_string_array (context, "ARGV",
                                         argc - 1, (const char **)argv + 1,
                                         &error))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]