bash 通过命令行指定 Doxygen 参数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11032280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:29:37  来源:igfitidea点击:

Specify Doxygen parameters through command line

bashdoxygen

提问by Potney Switters

Well I am creating a script to automatically generate documentation for my projects with Doxygen, which seems like an awesome tool.
What is not clear to me, is if the user can use specify directly parameters, such as project name, project description etc., by setting them besides command:

好吧,我正在创建一个脚本,用 Doxygen 为我的项目自动生成文档,这似乎是一个很棒的工具。
我不清楚的是,用户是否可以通过在命令之外设置它们来直接使用指定参数,例如项目名称、项目描述等:

doxygen -g "parameter modification here"
doxygen Doxyfile

Any tips appreciated!

任何提示表示赞赏!

回答by doxygen

Look at the answer for question 17 in the FAQ: http://www.doxygen.nl/manual/faq.html#faq_cmdline, repeated below for convenience:

查看 FAQ 中问题 17 的答案:http: //www.doxygen.nl/manual/faq.html#faq_cmdline,为方便起见,在下面重复:

Can I configure doxygen from the command line?

我可以从命令行配置 doxygen 吗?

Not via command line options, but doxygen can read from stdin, so you can pipe things through it. Here's an example how to override an option in a configuration file from the command line (assuming a UNIX environment):

不是通过命令行选项,但 doxygen 可以从 stdin 读取,因此您可以通过它进行管道传输。以下是如何从命令行覆盖配置文件中的选项的示例(假设为 UNIX 环境):

( cat Doxyfile ; echo "PROJECT_NUMBER=1.0" ) | doxygen -

For Windows the following would do the same:

对于 Windows,以下将执行相同的操作:

( type Doxyfile & echo PROJECT_NUMBER=1.0 ) | doxygen.exe -

If multiple options with the same name are specified then doxygen will use the last one. To append to an existing option you can use the += operator.

如果指定了多个具有相同名称的选项,则 doxygen 将使用最后一个。要附加到现有选项,您可以使用 += 运算符。

回答by hansfn

(This is an alternative to the accepted answer- most likely above.)

(这是已接受答案的替代方案- 很可能在上面。)

My preferred solution is to use environmental variables in the config file. Let's take "QUIET" as an example: In the config file I replace

我的首选解决方案是在配置文件中使用环境变量。让我们以“QUIET”为例:在配置文件中我替换

QUIET                  = NO

with

QUIET                  = $(DOXYGEN_QUIET)

I then call Doxygen as follows

然后我按如下方式调用 Doxygen

DOXYGEN_QUIET=YES doxygen configfile

or

或者

env DOXYGEN_QUIET=YES doxygen configfile

if used inside a (Bash) script. You could of course also export the variable DOXYGEN_QUIET so you don't have to type it for each run.

如果在(Bash)脚本中使用。您当然也可以导出变量 DOXYGEN_QUIET,这样您就不必为每次运行都键入它。

PS! I have a Bash script that run several Doxygen jobs, and it uses the standard -q option to run the jobs quietly by setting DOXYGEN_QUIET. I also set PROJECT_NAME using the same trick with an environmental variable.

附注!我有一个运行多个 Doxygen 作业的 Bash 脚本,它使用标准的 -q 选项通过设置 DOXYGEN_QUIET 来安静地运行这些作业。我还使用与环境变量相同的技巧来设置 PROJECT_NAME。

回答by Chris

As far as I know this is not possible: a doxygen build is configured through the configuration fileor with the GUI (which is much easier than trying to remember command line option names). Typing doxygen --helpat the command line and the documentation for the doxygen usagesuggest that all the command line options do is set which configuration file to read (and allow the user to get layout files and the like).

据我所知这是不可能的:doxygen 构建是通过配置文件或 GUI配置的(这比试图记住命令行选项名称容易得多)。doxygen --help在命令行输入和doxygen 使用的文档表明所有命令行选项所做的都是设置要读取的配置文件(并允许用户获取布局文件等)。

One way to modify configuration options from the command line would be to append options to the configuration file using something like (untested):

从命令行修改配置选项的一种方法是使用类似(未经测试)的内容将选项附加到配置文件:

echo "INPUT = some file" >> Doxyfile

This will append INPUT = some fileto your Doxyfileand any earlier values of INPUTare ignored. If you want to append an item to INPUTyou could use

这将附加INPUT = some file到您的Doxyfile并且任何较早的值都将INPUT被忽略。如果你想附加一个项目,INPUT你可以使用

echo "INPUT += some file" >> Doxyfile

Notice the +=. This respects INPUTvalues set earlier in the file.

请注意+=. 这尊重INPUT文件中较早设置的值。

Rather than appending to the configuration file you could always use sedto find and replace options.

而不是附加到配置文件,您总是可以sed用来查找和替换选项。