diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 13:56:27 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 13:56:27 +0100 |
commit | 3ee2b3777bee7604037a85761f6fc2c55e902f0d (patch) | |
tree | 4563b1e91a758c950960901efd1b577d6fd6b73a | |
parent | 3032bb0fd50418060f91a598d5ec1abc1b7f3efc (diff) | |
download | drminfo-3ee2b3777bee7604037a85761f6fc2c55e902f0d.tar.gz |
bash completion: rest
-rw-r--r-- | fbtest.c | 2 | ||||
-rw-r--r-- | gtktest.c | 14 | ||||
-rw-r--r-- | meson.build | 7 | ||||
-rw-r--r-- | prime.c | 14 | ||||
-rw-r--r-- | virtiotest.c | 14 |
5 files changed, 44 insertions, 7 deletions
@@ -135,7 +135,7 @@ int main(int argc, char **argv) image = load_image(optarg); break; case OPT_LONG_COMP_BASH: - complete_bash("fbinfo", long_opts); + complete_bash("fbtest", long_opts); exit(0); case 'h': usage(stdout); @@ -8,6 +8,7 @@ #include "render.h" #include "image.h" +#include "complete.h" cairo_surface_t *image; @@ -42,13 +43,21 @@ static void usage(FILE *fp) "\n"); } -struct option long_opts[] = { +enum { + OPT_LONG_COMP_BASH = 0x100, +}; + +static struct option long_opts[] = { { /* --- no argument --- */ .name = "help", .has_arg = false, .val = 'h', },{ + .name = "complete-bash", + .has_arg = false, + .val = OPT_LONG_COMP_BASH, + },{ /* --- with argument --- */ .name = "image", @@ -76,6 +85,9 @@ int main(int argc, char *argv[]) case 'i': ifile = optarg; break; + case OPT_LONG_COMP_BASH: + complete_bash("gtktest", long_opts); + exit(0); case 'h': usage(stdout); exit(0); diff --git a/meson.build b/meson.build index 721962f..30c6259 100644 --- a/meson.build +++ b/meson.build @@ -37,12 +37,13 @@ drmtest_srcs = [ 'drmtest.c', 'drmtools.c', 'drm-lease.c', 'drm-lease-x11.c', fbinfo_srcs = [ 'fbinfo.c', 'fbtools.c', 'logind.c', 'complete.c' ] fbtest_srcs = [ 'fbtest.c', 'fbtools.c', 'logind.c', 'complete.c', 'ttytools.c', 'render.c', 'image.c' ] -prime_srcs = [ 'prime.c', 'logind.c' ] -viotest_srcs = [ 'virtiotest.c', 'drmtools.c', 'logind.c', 'ttytools.c', 'render.c' ] +prime_srcs = [ 'prime.c', 'logind.c', 'complete.c' ] +viotest_srcs = [ 'virtiotest.c', 'drmtools.c', 'logind.c', 'complete.c', + 'ttytools.c', 'render.c' ] egltest_srcs = [ 'egltest.c', 'drmtools.c', 'drmtools-egl.c', 'drm-lease.c', 'drm-lease-x11.c', 'logind.c', 'complete.c', 'ttytools.c' ] -gtktest_srcs = [ 'gtktest.c', 'render.c', 'image.c' ] +gtktest_srcs = [ 'gtktest.c', 'render.c', 'image.c', 'complete.c' ] drminfo_deps = [ libdrm_dep, cairo_dep, pixman_dep, systemd_dep, xcb_dep, randr_dep ] @@ -17,6 +17,7 @@ #include <gbm.h> #include "logind.h" +#include "complete.h" #define TEST_WIDTH 640 #define TEST_HEIGHT 480 @@ -245,7 +246,11 @@ static void usage(FILE *fp) "\n"); } -struct option long_opts[] = { +enum { + OPT_LONG_COMP_BASH = 0x100, +}; + +static struct option long_opts[] = { { /* --- no argument --- */ .name = "help", @@ -256,6 +261,10 @@ struct option long_opts[] = { .has_arg = false, .val = 'l', },{ + .name = "complete-bash", + .has_arg = false, + .val = OPT_LONG_COMP_BASH, + },{ /* end of list */ } }; @@ -274,6 +283,9 @@ int main(int argc, char **argv) case 'l': list = true; break; + case OPT_LONG_COMP_BASH: + complete_bash("prime", long_opts); + exit(0); case 'h': usage(stdout); exit(0); diff --git a/virtiotest.c b/virtiotest.c index b4358f9..76b5b23 100644 --- a/virtiotest.c +++ b/virtiotest.c @@ -26,6 +26,7 @@ #include "logind.h" #include "ttytools.h" #include "render.h" +#include "complete.h" /* ------------------------------------------------------------------ */ @@ -240,7 +241,11 @@ static void usage(FILE *fp) "\n"); } -struct option long_opts[] = { +enum { + OPT_LONG_COMP_BASH = 0x100, +}; + +static struct option long_opts[] = { { /* --- no argument --- */ .name = "help", @@ -259,6 +264,10 @@ struct option long_opts[] = { .has_arg = false, .val = 'l', },{ + .name = "complete-bash", + .has_arg = false, + .val = OPT_LONG_COMP_BASH, + },{ /* --- with argument --- */ .name = "card", @@ -304,6 +313,9 @@ int main(int argc, char **argv) case 'l': listformat = true; break; + case OPT_LONG_COMP_BASH: + complete_bash("prime", long_opts); + exit(0); case 'h': usage(stdout); exit(0); |