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

Aperta Adatta ai principianti
#191 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
cli, embedded-iot

Direzione di ricerca

Inizia dall’errore per scheda sconosciuta in tools/embsim/main.c e dalla tabella boards[] e board_find() in tools/embsim/boards.c. Controlla le convenzioni di test esistenti in tests/golden/embsim*.sh e tests/golden/embsim/, quindi esegui il test mirato di EmbSim. Il lavoro è completato quando un errore di battitura come microbt suggerisce microbit, un nome senza senso elenca le schede senza suggerimenti e il codice di uscita e la prima riga dell’errore restano invariati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C
Stelle
1
Fork
2
Merge medio
20h 55m
PR unite (30g)
73

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di EmbLinkOs/EmbCC

Tutte le issue di EmbLinkOs/EmbCC

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.