From 3032bb0fd50418060f91a598d5ec1abc1b7f3efc Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 2 Jan 2020 13:46:38 +0100 Subject: bash completion: fb tools --- fbtest.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'fbtest.c') diff --git a/fbtest.c b/fbtest.c index a8aa930..082e6b9 100644 --- a/fbtest.c +++ b/fbtest.c @@ -18,6 +18,7 @@ #include "ttytools.h" #include "render.h" #include "image.h" +#include "complete.h" /* ------------------------------------------------------------------ */ @@ -72,7 +73,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", @@ -83,6 +88,10 @@ struct option long_opts[] = { .has_arg = false, .val = 'a', },{ + .name = "complete-bash", + .has_arg = false, + .val = OPT_LONG_COMP_BASH, + },{ /* --- with argument --- */ .name = "fbdev", @@ -125,6 +134,9 @@ int main(int argc, char **argv) case 'i': image = load_image(optarg); break; + case OPT_LONG_COMP_BASH: + complete_bash("fbinfo", long_opts); + exit(0); case 'h': usage(stdout); exit(0); -- cgit