In linux I am using this command to generate the doxygen documentation on the fly and in…
- User
In linux I am using this command to generate the doxygen documentation on the fly and in a terminal:
doxygen -g - | doxygen -
Can you help me adding these extra things:
- Generate only html docs, skipping latex
- Put the output in docs folder
- Use as project name "My project name"
- Assistant
To generate only HTML documentation, skip LaTeX, and output it in the "docs" folder with the project name "My project name" using the doxygen command, follow the updated command below:
bashdoxygen -g - | sed -e 's/^PROJECT_NAME *=.*/PROJECT_NAME = "My project name"/' -e 's/^GENERATE_LATEX *=.*/GENERATE_LATEX = NO/' -e 's/^OUTPUT_DIRECTORY *=.*/OUTPUT_DIRECTORY = docs/' | doxygen -Explanation:
doxygen -g -generates a default Doxyfile configuration.sedis used to modify the generated Doxyfile before pipe it todoxygen -.'s/^PROJECT_NAME *=.*/PROJECT_NAME = "My project name"/'replaces the default project name with "My project name".'s/^GENERATE_LATEX *=.*/GENERATE_LATEX = NO/'setsGENERATE_LATEXtoNOin order to skip LaTeX generation.'s/^OUTPUT_DIRECTORY *=.*/OUTPUT_DIRECTORY = docs/'sets the output directory to "docs".
- User
can you make the command exactly on how to be copied and pasted instead of adding commentaries at the end which makes difficult to copy and paste. Also add the quiet option so it doesn't show all that text when it is creating the docs
- Assistant
Certainly! Here's the revised command that can be copied and pasted directly:
bashdoxygen -g - | sed -e 's/^PROJECT_NAME *=.*/PROJECT_NAME = "My project name"/' -e 's/^GENERATE_LATEX *=.*/GENERATE_LATEX = NO/' -e 's/^OUTPUT_DIRECTORY *=.*/OUTPUT_DIRECTORY = docs/' | doxygen - > /dev/nullExplanation:
doxygen -g -generates a default Doxyfile configuration.sedis used to modify the generated Doxyfile before pipe it todoxygen -.'s/^PROJECT_NAME *=.*/PROJECT_NAME = "My project name"/'replaces the default project name with "My project name".'s/^GENERATE_LATEX *=.*/GENERATE_LATEX = NO/'setsGENERATE_LATEXtoNOin order to skip LaTeX generation.'s/^OUTPUT_DIRECTORY *=.*/OUTPUT_DIRECTORY = docs/'sets the output directory to "docs".| doxygen -pipes the modified Doxyfile to to generate the documentation.
- User
OK sed didn't work so I ended up using this command but it still output a terminal text, not as long as the previous one but I want it to be 100% quiet:
( cat Doxyfile ; echo "PROJECT_NAME=My project name" ; echo "OUTPUT_DIRECTORY=docs/" ; echo "GENERATE_LATEX=NO" ) | doxygen - >/dev/null
The terminal output is this: cat: Doxyfile: No such file or directory
it does work but shows this error, since it works I want it to not output anything. I tried "2>/dev/null | echo" and still output it
- Assistant
Apologies for the inconvenience. The
cat: Doxyfile: No such file or directoryerror occurs because it expects an existing Doxyfile. Here's an updated command that handles this error and eliminates any terminal output:bash( (doxygen -g 2>/dev/null && echo "PROJECT_NAME = My project name" && echo "OUTPUT_DIRECTORY = docs/" && echo "GENERATE_LATEX = NO") | doxygen - ) >/dev/null 2>&1Explanation:
doxygen -g 2>/dev/nullgenerates a default Doxyfile and suppresses any error messages if it already exists.echo "PROJECT_NAME = My project name"sets the project name to "My project name".echo "OUTPUT_DIRECTORY = docs/"sets the output directory to "docs".echo "GENERATE_LATEX = NO"setsGENERATE_LATEXtoNOin order to skip LaTeX generation.doxygen -pipes the modified Doxyfile to for generating the documentation.
- User
Ok it works perfectly, now I want to ask about the docs, When I create a new method in c++ using codeblocks, it adds this to the doc of the method:
/** @brief ClassName * * @todo: document this function */
is this compatible with doxygen? Or what doc generator is used with this? Why it adds @ instead of "" that is used in doxygen? Can I make it compatible with doxygen?
- Assistant
The documentation format you mentioned:
cpp/** @brief ClassName * * @todo: document this function */is not compatible with Doxygen by default, as it uses a different syntax than Doxygen's markup. Doxygen uses the backslash "" syntax for its tags, such as
\brief,\param,\return, etc.The format you mentioned might be specific to another documentation generator or IDE template. Based on your comment about Code::Blocks, it seems that Code::Blocks might have its own placeholder format for generating documentation. In this case, it's not directly compatible with Doxygen.
If you wish to make it compatible with Doxygen, you'll need to manually convert the tags to their respective Doxygen equivalents. For example, you would replace
@briefwith\brief.Here's the modified version:
cpp/** \brief ClassName * * \todo Document this function */By using the Doxygen-compatible syntax, you can properly generate documentation with Doxygen.