Files
OpenBK7231T_App/docs/commanddocs.md
btsimonh 35ce28386e Update to write two files, one user-centric, and one dev-centric.
Move the files to docs/
add documentation.
NOTE: This MODIFIES the source files to add comment lines if they do not exist.
2022-11-14 09:21:36 +00:00

1.3 KiB

How to automatically document commands

Commands are reigstered like this:

CMD_RegisterCommand("obkDeviceList", "", Cmd_obkDeviceList, "qqq", NULL);

by running npm run getcommands the source code is parsed and modified to add comment lines above such lines, if they do not already exist:

	//cmddetail:{"name":"obkDeviceList","args":"",
	//cmddetail:"descr":"qqq",
	//cmddetail:"fn":"Cmd_obkDeviceList","file":"driver/drv_ssdp.c","requires":"",
	//cmddetail:"examples":""}
    CMD_RegisterCommand("obkDeviceList", "", Cmd_obkDeviceList, "qqq", NULL);

Such comment lines are parsed during the proces to create entries in docs/commands.md:

Command Arguments Description
obkDeviceList qqq

and docs/commands-extended.md

Command Arguments Description Loc
obkDeviceList qqq driver/drv_ssdp.c
Cmd_obkDeviceList

The JSON strings which result in the entries may be multi-line by using \n in-line.

When adding a new command, add the

CMD_RegisterCommand("obkDeviceList", "", Cmd_obkDeviceList, "qqq", NULL);

line, save your file, run npm run getcommands, and then augment the json with details.