embsim: an unknown --board should list the boards and suggest the closest

未关闭 适合新手
#191 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
cli, embedded-iot

调研方向

从 tools/embsim/main.c 中未知开发板的错误以及 tools/embsim/boards.c 中的 boards[] 表和 board_find() 开始。查看 tests/golden/embsim*.sh 和 tests/golden/embsim/ 中现有的测试惯例,然后运行针对性的 EmbSim 测试。完成标准是:像 microbt 这样的拼写错误会提示 microbit,无意义的名称会列出开发板但不提供建议,并且退出状态和第一行错误信息保持不变。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue

Context. EmbSim knows many boards (see embsim --help), but a wrong name only says no:

$ ./embsim --board microbt fw.elf
embsim: unknown board 'microbt'

It should list the boards and suggest the closest, for example did you mean 'microbit'?.

Where.

  • tools/embsim/main.c, line 221: the error. The name is tried as a board (board_find), then as a part from a device pack (board_part).
  • tools/embsim/boards.c: line 217 has boards[], the table of every board; line 516 has board_find().
  • Tests: the EmbSim tests live in tests/golden/embsim*.sh and tests/golden/embsim/. Add a small one rather than extending a board's own test.

Steps.

  1. On an unknown name, print the board names from boards[], and the closest one if it is within a few edits. EmbSim is a separate program, so a small edit-distance function in tools/embsim is fine.
  2. Keep the exit status and the first line as they are; add lines after it.
  3. Add a test with a typo and with a nonsense name.

Done when --board microbt suggests microbit, a nonsense name lists the boards without a suggestion, and the test passes. Do not run tests/golden/boards.sh for this: it talks to real boards on serial ports.

Before you start: the contributor's guide has the rules. A new test counts only after it has failed against the code before your change, and a commit subject reads area: summary. Questions are welcome in the comments or in Discussions.

主要语言
C
星标
1
派生
2
平均合并
20 小时 55 分钟
30 天内合并 PR
73

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

EmbLinkOs/EmbCC 的其他 Issue

查看 EmbLinkOs/EmbCC 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。