MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / msh_opt_auto_complete

Function msh_opt_auto_complete

components/finsh/msh.c:951–983  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

949}
950
951void 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
985int msh_cmd_opt_id_get(int argc, char *argv[], void *options)
986{

Callers 1

shell_auto_completeFunction · 0.85

Calls 5

msh_get_argcFunction · 0.85
msh_get_cmd_optFunction · 0.85
msh_get_cmdFunction · 0.85
msh_opt_helpFunction · 0.85
msh_opt_completeFunction · 0.85

Tested by

no test coverage detected