VPP-221 CLI auto-documentation infrastructure 10/2710/2
authorChris Luke <chrisy@flirble.org>
Mon, 25 Jul 2016 20:38:11 +0000 (16:38 -0400)
committerChris Luke <chrisy@flirble.org>
Wed, 7 Sep 2016 19:16:36 +0000 (15:16 -0400)
commit78e0e3af7072cd8977c73c41863776be10d54155
tree57e161337a563b237bfaf97ba8e01d6cc232e616
parentc1ac47b61ca6f788bb8cc08128c79edc743dcb99
VPP-221 CLI auto-documentation infrastructure

[Note: This is an amalgamation of several patches cherry-picked from
master all related to introducing auto-CLI documentation. See commits
d4024f58 ee4743ad 16bcf7d8 e0d802bc 54ccf226]

As a step before Doxygen, extract CLI-related struct initializers
from the code and parse that into a summary of the CLI commands
available with the provided help text, such as it is. At the moment
this only renders this into an indexed Markdown file that Doxygen
then picks up but later we can use this information to enrich the
existing VLIB_CLI_COMMAND macro documentor as well as provide
runtime documentation to VPP that is stored on disk outside the
binary image.

Additionally support a comment block immediately prior to
VLIB_CLI_COMMAND CLI command definitions in the form /*? ... ?*/
that can be used to include long-form documentation without having
it compiled into VPP.

Examples of documenting CLI commands can be found in
vlib/vlib/unix/cli.c which, whilst not perfect, should provide a
starting point. Screen captures of sample output can be seen at
https://chrisy.flirble.org/vpp/doxy-cli-example.png and
https://chrisy.flirble.org/vpp/doxy-cli-index.png .

Next, shift the Doxygen root makefile targets to their own Makefile.
The primary reason for this is that the siphon targets do dependency
tracking which means it needs to generate those dependencies whenever
make is run; that is pointless if we're not going to generate any
documentation. This includes the package dependencies since they since
they sometimes unnecessarily interfere with the code build in some cases
at the moment; later we will look to building a Python venv to host the
Python modules we use.

One final remark: In future we may consider deprecating .long_help
in the VLIB_CLI_COMMAND structure entirely but add perhaps .usage_help.
.short_help would be reserved for a summary of the command function
and .usage_help provide the syntax of that command. These changes would
provide great semantic value to the automaticly generated CLI
documentation. I could also see having .long_help replaced by a
mechanism that reads it from disk at runtime with a rudimentary
Markdown/Doxygen filter so that we can use the same text that is used in
the published documentation.

Change-Id: I8afccfd7fe2096411d8064ac954ca5a2cbca9ae7
Signed-off-by: Chris Luke <chrisy@flirble.org>
12 files changed:
.gitignore
Makefile
doxygen/Makefile [new file with mode: 0644]
doxygen/dir.dox.sample
doxygen/doxygen.cfg
doxygen/filter_c.py
doxygen/filter_h.py [new file with mode: 0755]
doxygen/siphon_generate.py [new file with mode: 0755]
doxygen/siphon_process.py [new file with mode: 0755]
vlib/vlib/dir.dox
vlib/vlib/unix/cli.c
vlib/vlib/unix/dir.dox [new file with mode: 0644]