diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 16:53:13 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 16:53:13 +0100 |
commit | 5d20463d9fe2b98db639f6c9c01480092390035e (patch) | |
tree | 10a9eed0161438ce9b0d7c5317b95f22d105614a | |
parent | e47b389991c6adbed6e1831a92b2e48d9513b89d (diff) | |
download | drminfo-5d20463d9fe2b98db639f6c9c01480092390035e.tar.gz |
format completion
-rw-r--r-- | complete.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -29,12 +29,19 @@ " COMPREPLY=( $(compgen -W \"$words\" -- \"$cur\") )\n" \ " ;;\n" +#define CASE_FORMAT \ + " --format)\n" \ + " words=$(drminfo --test-formats)\n" \ + " COMPREPLY=( $(compgen -W \"$words\" -- \"$cur\") )\n" \ + " ;;\n" + void complete_bash(const char *command, struct option *opts) { bool have_image = false; bool have_card = false; bool have_fbdev = false; bool have_output = false; + bool have_format = false; char opt_all[1024]; char opt_arg[1024]; int pos_all = 0; @@ -55,6 +62,8 @@ void complete_bash(const char *command, struct option *opts) have_fbdev = true; } else if (strcmp(opts[i].name, "output") == 0) { have_output = true; + } else if (strcmp(opts[i].name, "format") == 0) { + have_format = true; } else if (opts[i].has_arg) { /* options without argument completion */ @@ -79,7 +88,7 @@ void complete_bash(const char *command, struct option *opts) " cur=\"${COMP_WORDS[COMP_CWORD]}\"\n" " prev=\"${COMP_WORDS[COMP_CWORD-1]}\"\n" " case \"$prev\" in\n" - "%s%s%s%s" + "%s%s%s%s%s" " %s)\n" " COMPREPLY=()\n" " ;;\n" @@ -96,6 +105,7 @@ void complete_bash(const char *command, struct option *opts) have_card ? CASE_CARD : "", have_fbdev ? CASE_FBDEV : "", have_output ? CASE_OUTPUT : "", + have_format ? CASE_FORMAT : "", opt_arg, opt_all, command, command); } |