Skip to content

[msh] 自动补全子选项 没有使用说明与注释 #8691

@wdfk-prog

Description

@wdfk-prog
  • 看到RTT最新版本支持MSH的自动补全功能,想要测试使用;却无从下手

  • 查看合并的pr:【msh】新增msh自动补全子选项特性 #8086
    才从cmd.c文件中搞懂使用方式

    CMD_OPTIONS_NODE_START(pwm_list)
    CMD_OPTIONS_NODE(PWM_LIST_PROBE, probe, probe pwm by name)
    CMD_OPTIONS_NODE(PWM_LIST_ENABLE, enable, enable pwm channel)
    CMD_OPTIONS_NODE(PWM_LIST_DISABLE, disable, disable pwm channel)
    CMD_OPTIONS_NODE(PWM_LIST_GET, get, get pwm channel info)
    CMD_OPTIONS_NODE(PWM_LIST_SET, set, set pwm channel info)
    CMD_OPTIONS_NODE(PWM_LIST_PHASE, phase, set pwm phase)
    CMD_OPTIONS_NODE(PWM_LIST_DEAD_TIME, dead_time, set pwm dead time)
    CMD_OPTIONS_NODE_END
    MSH_CMD_EXPORT_ALIAS(pwm_list, pwm, control pwm device, optenable);

  • 是否应该在使用时附上使用方式

    /**
    * @ingroup msh
    *
    * This macro exports a command to module shell.
    *
    * @param command is the name of the command.
    * @param desc is the description of the command, which will show in help list.
    * @param opt This is an option, enter any content to enable option completion
    */
    /* MSH_CMD_EXPORT(command, desc) or MSH_CMD_EXPORT(command, desc, opt) */
    #define MSH_CMD_EXPORT(...) \
    __MSH_GET_MACRO(__VA_ARGS__, _MSH_FUNCTION_CMD2_OPT, \
    _MSH_FUNCTION_CMD2)(__VA_ARGS__)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions