-
Notifications
You must be signed in to change notification settings - Fork 5.3k
【msh】新增msh自动补全子选项特性 #8086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【msh】新增msh自动补全子选项特性 #8086
Conversation
136cdee to
391c908
Compare
| */ | ||
| #define MSH_CMD_EXPORT(command, desc) \ | ||
| MSH_FUNCTION_EXPORT_CMD(command, command, desc) | ||
| /* MSH_CMD_EXPORT(command, desc) or MSH_CMD_EXPORT(command, desc, opt) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看起来和之前是兼容的是吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
完全兼容
components/finsh/cmd.c
Outdated
| case RT_Object_Class_Device: list_device(); break; | ||
| #endif /* RT_USING_DEVICE */ | ||
| #ifdef RT_USING_DFS | ||
| case 0x100: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
做个宏定义吧,不应该出现绝对数值的。
components/finsh/Kconfig
Outdated
| int "The number of arguments for a shell command" | ||
| default 10 | ||
|
|
||
| config FINSH_OPTION_COMPLETION_ENABLED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
风格不统一了,用FINSH_USING_OPTION_COMPLETION吧
components/finsh/cmd.c
Outdated
| } | ||
| #endif /* RT_USING_DEVICE */ | ||
|
|
||
| #ifndef FINSH_OPTION_COMPLETION_ENABLED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面部分代码是否也可以做到统一,而不是完全函数级的条件宏控制
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面的处理中使用到了MSH_OPT_ID_GET这个宏,参数处理上简单了很多,与之前的方式是不一样的,做不到统一
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把之前的处理方式改掉可以做到统一
components/finsh/finsh.h
Outdated
| #define CMD_OPTIONS_NODE(_id, _name, _des) {.id = _id, .name = #_name, .des = #_des}, | ||
| #define CMD_OPTIONS_NODE_END {0},}; | ||
|
|
||
| extern void msh_opt_list_dump(void *options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
头文件中函数声明不需要使用extern
| msh_auto_complete(prefix); | ||
|
|
||
| #ifdef FINSH_OPTION_COMPLETION_ENABLED | ||
| msh_opt_auto_complete(prefix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也许未来在auto complete方面,可以用链表插件的方式,可以在msh中一级级的挂载多中自动完成
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前考虑过这个, 在这套上面加链表改动很小就能实现,目前暂时用不到,所以只支持了二级
This reverts commit 2d630e3.

拉取/合并请求描述:(PR description)
[
新增msh自动补全子选项特性, 关闭旧的pr #7304,重新整理提交
并确认并列出已经在什么情况或板卡上进行了测试。
And confirm in which case or board has been tested. -->
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
在什么测试环境下测试通过 (what is the test environment)
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up