A basic doxygen filter (originally written in GNU sed) allowing you to add inline-documentation to your bash shell scripts.
All lines starting with a ##
(without any leading blanks) are
passed to doxygen. You can use all the doxygen commands you want in
those lines. (see doxygen
documentation).
Some top level declarations will be recognized if you use the
declare
primitive:
declare -a
for arraysdeclare -A
for associative arraysdeclare -i
for integersdeclare
statement will consider variable is a string.declare -l
will mark the variable as LowerCasedeclare -u
will mark the variable as UpperCasedeclare -x
will mark the variable as Exporteddeclare -r
will mark the variable as ReadOnlyexport
statement will
also be recognized and the variable will be marked as an Exported
String.Functions declaration will be recognized if all these conditions are met:
## @fn
line is found above the function declaration,function
keyword, but always with ()
.{
char is on the same line as the
funcname()
instruction.doxygen -g
.EXTENSION_MAPPING = sh=C
FILE_PATTERNS = *.sh
INTPUT_FILTER
or the
FILTER_PATTERN
directive of your Doxyfile. If doxygen-bash.sed is
in your $PATH, then you can just invoke it as is, else use sed -n -f /path/to/doxygen-bash.sed --
.CAREFUL: If you are a BSD and or a Mac user, you will definitely want
to use gsed
instead of sed
to make it work.
Yes.
Q. Does it actually work ? A. The bash-argsparse project uses this filter. Check the result. Click on the links. See by yourself.
Q. Is it rock-solid ? A. No.
Q. Do you accept patches ? A. Definitely.
Q. Why is the project named bash-doxygen while the filter is named doxygen-bash ? A. Yeah, haha. Seriously.
Q. Can I include the doxygen-bash.sed file in my own tarball ? A. See the COPYING file.
Q. Dude. sed ? Seriously ? A. Are you.. Jealous ?
Q. ... ? A. Don't you dare !