diff options
Diffstat (limited to 'common/complete.c')
-rw-r--r-- | common/complete.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/complete.c b/common/complete.c index d84839637c..c2b37e4e02 100644 --- a/common/complete.c +++ b/common/complete.c @@ -145,6 +145,26 @@ int command_complete(struct string_list *sl, char *instr) return 0; } +int device_complete(struct string_list *sl, char *instr) +{ + struct device_d *dev; + int len; + + if (!instr) + instr = ""; + + len = strlen(instr); + + for_each_device(dev) { + if (strncmp(instr, dev_name(dev), len)) + continue; + + string_list_add_asprintf(sl, "%s ", dev_name(dev)); + } + + return COMPLETE_CONTINUE; +} + static int device_param_complete(char *begin, struct device_d *dev, struct string_list *sl, char *instr) { |