Changeset e8d48d2 in mainline


Ignore:
Timestamp:
2016-03-08T09:49:41Z (8 years ago)
Author:
Aurelio Colosimo <aurelio@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3266412
Parents:
a363016
Message:

kconsole args tab completion implemented for test command

Location:
kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    ra363016 re8d48d2  
    206206        .func = cmd_test,
    207207        .argc = 1,
    208         .argv = test_argv
     208        .argv = test_argv,
     209        .hints_enum = tests_hints_enum
    209210};
    210211
  • kernel/test/test.c

    ra363016 re8d48d2  
    3434
    3535#include <test.h>
     36#include <str.h>
    3637
    3738bool test_quiet;
     
    6869};
    6970
     71const char* tests_hints_enum(const char *input, const char **help,
     72    void **ctx)
     73{
     74        size_t len = str_length(input);
     75        test_t **test = (test_t**)ctx;
     76       
     77        if (*test == NULL)
     78                *test = tests;
     79       
     80        for (; (*test)->name; (*test)++) {
     81                const char *curname = (*test)->name;
     82               
     83                if (str_length(curname) < len)
     84                        continue;
     85               
     86                if (str_lcmp(input, curname, len) == 0) {
     87                        (*test)++;
     88                        if (help)
     89                                *help = (*test)->desc;
     90                        return (curname + str_lsize(curname, len));
     91                }
     92        }
     93       
     94        return NULL;
     95}
     96
    7097/** @}
    7198 */
  • kernel/test/test.h

    ra363016 re8d48d2  
    8585extern test_t tests[];
    8686
     87extern const char* tests_hints_enum(const char *, const char **, void **);
     88
    8789#endif
    8890
Note: See TracChangeset for help on using the changeset viewer.