| 949 | } |
| 950 | |
| 951 | void msh_opt_auto_complete(char *prefix) |
| 952 | { |
| 953 | int argc; |
| 954 | char *opt_str = RT_NULL; |
| 955 | msh_cmd_opt_t *opt = RT_NULL; |
| 956 | |
| 957 | argc = msh_get_argc(prefix, &opt_str); |
| 958 | if (argc) |
| 959 | { |
| 960 | opt = msh_get_cmd_opt(prefix); |
| 961 | } |
| 962 | else if (!msh_get_cmd(prefix, strlen(prefix)) && (' ' == prefix[strlen(prefix) - 1])) |
| 963 | { |
| 964 | opt = msh_get_cmd_opt(prefix); |
| 965 | } |
| 966 | |
| 967 | if (opt && opt->id) |
| 968 | { |
| 969 | switch (argc) |
| 970 | { |
| 971 | case 0: |
| 972 | msh_opt_help(opt); |
| 973 | break; |
| 974 | |
| 975 | case 1: |
| 976 | msh_opt_complete(opt_str, opt); |
| 977 | break; |
| 978 | |
| 979 | default: |
| 980 | break; |
| 981 | } |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | int msh_cmd_opt_id_get(int argc, char *argv[], void *options) |
| 986 | { |
no test coverage detected