Tools: Add bash completions for xkbcli
[platform/upstream/libxkbcommon.git] / tools / xkbcli.c
index fbab9dd..3602fb9 100644 (file)
@@ -37,7 +37,41 @@ usage(void)
            "Global options:\n"
            "  -h, --help ...... show this help and exit\n"
            "  -V, --version ... show version information and exit\n"
-           "\n");
+           /* WARNING: The following is parsed by the bash completion script.
+            *          Any change to the format (in particular to the indentation)
+            *          should kept in the script in sync. */
+           "Commands:\n"
+#if HAVE_XKBCLI_LIST
+           "  list\n"
+           "    List available rules, models, layouts, variants and options\n"
+           "\n"
+#endif
+#if HAVE_XKBCLI_INTERACTIVE_WAYLAND
+           "  interactive-wayland\n"
+           "    Interactive debugger for XKB keymaps for Wayland\n"
+           "\n"
+#endif
+#if HAVE_XKBCLI_INTERACTIVE_X11
+           "  interactive-x11\n"
+           "    Interactive debugger for XKB keymaps for X11\n"
+           "\n"
+#endif
+#if HAVE_XKBCLI_INTERACTIVE_EVDEV
+           "  interactive-evdev\n"
+           "    Interactive debugger for XKB keymaps for evdev\n"
+           "\n"
+#endif
+#if HAVE_XKBCLI_COMPILE_KEYMAP
+           "  compile-keymap\n"
+           "    Compile an XKB keymap\n"
+           "\n"
+#endif
+#if HAVE_XKBCLI_HOW_TO_TYPE
+           "  how-to-type\n"
+           "    Print key sequences to type a Unicode codepoint\n"
+           "\n"
+#endif
+           );
 }
 
 int
@@ -51,7 +85,6 @@ main(int argc, char **argv)
 
     while (1) {
         int c;
-#if HAVE_GETOPT_LONG
         static struct option opts[] = {
             { "help",    no_argument, 0, OPT_HELP },
             { "version", no_argument, 0, OPT_VERSION },
@@ -59,9 +92,6 @@ main(int argc, char **argv)
         };
 
         c = getopt_long(argc, argv, "+hV", opts, &option_index);
-#else
-        c = getopt(argc, argv, "+hV");
-#endif
         if (c == -1)
             break;