[Xfce4-commits] <terminal:nick/man> Print options summary instead of opening the man page.

Nick Schermer noreply at xfce.org
Mon Dec 14 13:48:01 CET 2009


Updating branch refs/heads/nick/man
         to 59725fc950b9a93379e1794e7e34c93a35b580e8 (commit)
       from 8557361acc99511f09cbbb389ff9694aed8521eb (commit)

commit 59725fc950b9a93379e1794e7e34c93a35b580e8
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Dec 14 13:43:26 2009 +0100

    Print options summary instead of opening the man page.
    
    This is more convenient most of the time, since most of the
    options speak for themselve. Referrer to the man page
    for full explanation of the commands.

 terminal/main.c |   46 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/terminal/main.c b/terminal/main.c
index fb70284..12e6e2a 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -40,6 +40,43 @@
 
 
 
+static void
+usage (void)
+{
+  g_print ("%s\n"
+           "  %s [%s...]\n\n",
+           _("Usage:"), PACKAGE_NAME, _("OPTION"));
+
+  g_print ("%s:\n"
+           "  -h, --help; -V, --version; --disable-server;\n"
+           "  --default-display=%s; --default-working-directory=%s\n\n",
+           _("General Options"), _("display"), _("directory"));
+
+  g_print ("%s:\n"
+           "  --tab; --window\n\n",
+           _("Window or Tab Separators"));
+
+  g_print ("%s:\n"
+           "  -x, --execute; -e, --command=%s; -T, --title=%s;\n"
+           "  --working-directory=%s; -H, --hold\n\n",
+           _("Tab Options"), _("command"), _("title"), _("directory"));
+
+  g_print ("%s:\n"
+           "  --display=%s; --geometry=%s; --role=%s;\n"
+           "  --startup-id=%s; -I, --icon=%s; --fullscreen; --maximize;\n"
+           "  --show-menubar, --hide-menubar; --show-borders, --hide-borders;\n"
+           "  --show-toolbars, --hide-toolbars\n\n",
+           _("Window Options"), _("display"), _("geometry"), _("role"),
+           _("string"), _("icon"));
+
+  g_print (_("See for full explanation of the options the %s man page."),
+           PACKAGE_NAME);
+
+  g_print ("\n\n");
+}
+
+
+
 int
 main (int argc, char **argv)
 {
@@ -91,13 +128,8 @@ main (int argc, char **argv)
     }
   else if (G_UNLIKELY (show_help))
     {
-      if (!g_spawn_command_line_sync ("man "PACKAGE_NAME, NULL, NULL, &n, NULL))
-        {
-          g_print (_("For help on the command line options view the %s "
-                     "manual page or HTML documentation."), PACKAGE_NAME);
-        }
-
-      return n;
+      usage ();
+      return EXIT_SUCCESS;
     }
 
   /* create a copy of the standard arguments with our additional stuff */



More information about the Xfce4-commits mailing list