[gnome-terminal] client: legacy: Warn on deprecated exec options



commit ad4edbd11874007bd73de29bfb2cedb8054644d1
Author: Christian Persch <chpe gnome org>
Date:   Wed Nov 16 16:03:14 2016 +0100

    client: legacy: Warn on deprecated exec options
    
    All of -e, -x, --command, --execute are deprecated, so warn
    if they're used and point to the only non-deprecated way to
    pass command arguments.

 src/terminal-options.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/terminal-options.c b/src/terminal-options.c
index 360b890..afec6aa 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -224,6 +224,16 @@ deprecated_option_warning (const gchar *option_name)
   g_printerr ("\n");
 }
 
+static void
+deprecated_command_option_warning (const char *option_name)
+{
+  deprecated_option_warning (option_name);
+
+  /* %s is being replaced with "-- " (without quotes), which must be used literally, not translatable */
+  g_printerr (_("Use ā€œ%sā€ to terminate the options and put the command line to execute after it."), "-- ");
+  g_printerr ("\n");
+}
+
 static gboolean
 unsupported_option_callback (const gchar *option_name,
                              const gchar *value,
@@ -295,6 +305,8 @@ option_command_callback (const gchar *option_name,
   GError *err = NULL;
   char  **exec_argv;
 
+  deprecated_command_option_warning (option_name);
+
   if (!g_shell_parse_argv (value, NULL, &exec_argv, &err))
     {
       g_set_error(error,
@@ -846,6 +858,9 @@ terminal_options_parse (const char *working_directory,
       if (!is_execute && !is_dashdash)
         continue;
 
+      if (is_execute)
+        deprecated_command_option_warning (argv[i]);
+
       options->execute = is_execute;
 
       /* Skip the switch */


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