1 This is help2man-zh_CN.info.tmp, produced by makeinfo version 6.5 from
4 本文档记载 GNU ‘help2man’ 命令,用以从其他命令的 ‘--help’ 和 ‘--version’
7 版权所有 (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010,
8 2011, 2012, 2013, 2014, 2015 自由软件基金会。
10 Permission is granted to make and distribute verbatim copies of this
11 manual provided the copyright notice and this permission notice are
12 preserved on all copies.
14 Permission is granted to copy and distribute modified versions of
15 this manual under the conditions for verbatim copying, provided that the
16 entire resulting derived work is distributed under the terms of a
17 permission notice identical to this one.
19 Permission is granted to copy and distribute translations of this
20 manual into another language, under the above conditions for modified
21 versions, except that this permission notice may be stated in a
22 translation approved by the Foundation.
25 * help2man-zh_CN: (help2man-zh_CN). 自动手册页生成。
29 File: help2man-zh_CN.info.tmp, Node: Top, Next: 概览, Up: (dir)
34 ‘help2man’ 可从 ‘--help’ 和 ‘--version’ 其他命令的输出生成简单的手册页。
39 * 调用 help2man:: 如何运行 ‘help2man’。
40 * --help 建议:: 建议的 –help 输出排版。
42 * Makefile 用法:: 同 ‘make’ 一起使用‘help2man’。
44 * 示例:: ‘help2man’ 示例输出。
46 * 可用性:: 获取 ‘help2man’。
49 File: help2man-zh_CN.info.tmp, Node: 概览, Next: 调用 help2man, Prev: Top, Up: Top
54 ‘help2man’ 是一种从程序输出自动生成简单的手册页的工具。
56 Although manual pages are optional for GNU programs other projects,
57 such as Debian require them (*note (standards)Man Pages::)
59 本程序旨在为软件作者提供一个简单的方法,使得他们可以无需认真维护却可
62 给定一个程序,若其能提供合理标准的 ‘--help’ 和 ‘--version’ 输出,
63 ‘help2man’ 可以将那些信息整理成像手册页一样的东西。
66 File: help2man-zh_CN.info.tmp, Node: 调用 help2man, Next: --help 建议, Prev: 概览, Up: Top
69 ***********************
73 help2man [选项]... 可执行文件
79 使用 字符串 作为手册页的 ‘名称’ 段的描述。
81 By default (for want of anything better) this paragraph contains
82 ‘manual page for PROGRAM VERSION’.
84 此选项覆盖一个包含文件 ‘[名称]’ 章节 (*note 包含文字::).
88 将 章节 作为手册页的分类号。默认值为 1。
92 Set the name of the manual section to SECTION, used as a centred
93 heading for the manual page. By default ‘User Commands’ is used
94 for pages in section 1, ‘Games’ for section 6 and ‘System
95 Administration Utilities’ for sections 8 and 1M.
99 The program source is used as a page footer, and often contains the
100 name of the organisation or a suite of which the program is part.
101 By default the value is the package name and version.
105 设置输出语区(默认为 ‘C’)。程序本身和 ‘help2man’ 都必须支持给定的
110 从 文件 包含内容(*note 包含文字::)。
114 A variant of ‘--include’ for use in Makefile pattern rules which
115 does not require FILE to exist.
119 将输出写入到 FILE 而非 ‘stdout’。
127 Suppress inclusion of a ‘SEE ALSO’ paragraph directing the reader
128 to the Texinfo documentation.
132 Drop ‘lt-’ prefix from instances of the program name in the
133 synopsis (‘libtool’ creates wrapper scripts in the build directory
134 which invoke ‘foo’ as ‘.libs/lt-foo’).
140 By default ‘help2man’ passes the standard ‘--help’ and ‘--version’
141 options to the executable although alternatives may be specified using:
144 ‘--help-option=OPTION’
151 ‘--version-string=STRING’
154 ‘--no-discard-stderr’
155 Include stderr when parsing option output.
158 File: help2man-zh_CN.info.tmp, Node: --help 建议, Next: 包含文字, Prev: 调用 help2man, Up: Top
163 Here are some recommendations for what to include in your ‘--help’
164 output. Including these gives ‘help2man’ the best chance at generating
165 a respectable man page, as well as benefitting users directly.
167 See *note (standards)Command-Line Interfaces:: and *note
168 (standards)Man Pages::, for the official GNU standards relating to
169 ‘--help’ and man pages.
171 • A synopsis of how to invoke the program. If different usages of
172 the program have different invocations, then list them all. For
173 example (edited for brevity):
175 Usage: cp [OPTION]... SOURCE DEST
176 or: cp [OPTION]... SOURCE... DIRECTORY
179 Use ‘argv[0]’ for the program name in these synopses, just as it
180 is, with no directory stripping. This is in contrast to the
181 canonical (constant) name of the program which is used in
184 • A very brief explanation of what the program does, including
185 default and/or typical behaviour. For example, here is ‘cp’’s:
187 将 SOURCE 拷贝到 DEST,或将多个 SOURCE 拷贝到 DIRECTORY。
189 • A list of options, indented to column 2. If the program supports
190 one-character options, put those first, then the equivalent long
191 option (if any). If the option takes an argument, include that
192 too, giving it a meaningful name. Align the descriptions in a
193 convenient column, if desired. Note that to be correctly
194 recognised by ‘help2man’ the description must be separated from the
195 options by at least two spaces and descriptions continued on
196 subsequent lines must start at the same column.
198 Here again is an (edited) excerpt from ‘cp’, showing a short option
199 with an equivalent long option, a long option only, and a short
202 -a, --archive 相当于 -dpR
203 --backup[=CONTROL] 对每个文件备份 ...
204 -b 就像 --backup 不过 ...
206 For programs that take many options, it may be desirable to split
207 the option list into sections such as ‘Global’, ‘Output control’,
208 or whatever makes sense in the particular case. It is usually best
209 to alphabetise (by short option name first, then long) within each
210 section, or the entire list if there are no sections.
212 • Any useful additional information about program behaviour, such as
213 influential environment variables, further explanation of options,
214 etc. For example, ‘cp’ discusses ‘VERSION_CONTROL’ and sparse
217 • A few examples of typical usage, at your discretion. One good
218 example is usually worth a thousand words of description, so this
219 is highly recommended.
221 • In closing, a line stating how to email bug reports. Typically,
222 MAILING-ADDRESS will be ‘bug-PROGRAM@gnu.org’; please use this form
223 for GNU programs whenever possible. It’s also good to mention the
224 home page of the program, other mailing lists, etc.
226 The ‘argp’ and ‘popt’ programming interfaces let you specify option
227 descriptions for ‘--help’ in the same structure as the rest of the
228 option definition; you may wish to consider using these routines for
229 option parsing instead of ‘getopt’.
231 By default ‘help2man’ has some heuristics for identifying manual page
232 sections: a line consisting of ‘Options:’ for example will cause the
233 following text to appear in the ‘OPTIONS’ section, and a line beginning
234 with ‘Copyright’ will appear in the ‘COPYRIGHT’ section. Outside of
235 these heuristics, a line consisting of ‘*Words*’ will start a new
236 section, and ‘Words:’ a new sub-section.
239 File: help2man-zh_CN.info.tmp, Node: 包含文字, Next: Makefile 用法, Prev: --help 建议, Up: Top
242 **********************
244 额外的静态文字可用 ‘--include’ 和 ‘--opt-include’(*note 调用
245 help2man::)加入生成的手册页中。尽管这些文件可以任意命名,我们还是推荐使
246 用将 ‘.h2m’ 拓展名用于 ‘help2man’ 包含文件以保证一致性。
248 The format for files included with these option is simple:
256 逐字 *roff 文字块将在给定的 ‘[章节]’(大小写不敏感)开始处,或在匹配
259 Patterns use the Perl regular expression syntax and may be followed
260 by the ‘i’, ‘s’ or ‘m’ modifiers (*note perlre(1): (*manpages*)perlre.)
262 第一节前的行,或由 ‘-’ 开始的模式,将被认为是选项。其他的都将被安静地
280 Any ‘[name]’ or ‘[synopsis]’ sections appearing in the include file
281 will replace what would have automatically been produced (although you
282 can still override the former with ‘--name’ if required).
284 其他章节会自动附加到以上自动生成章节之上,或按照它们在包含文件中出现
287 Placement of the text within the section may be explicitly requested
288 by using the syntax ‘[<section]’, ‘[=section]’ or ‘[>section]’ to place
289 the additional text before, in place of, or after the default output
293 File: help2man-zh_CN.info.tmp, Node: Makefile 用法, Next: 本地化手册页, Prev: 包含文字, Up: Top
295 5 同 ‘make’ 一起使用 ‘help2man’。
296 *********************************
298 A suggested use of ‘help2man’ in Makefiles is to have the manual page
299 depend not on the binary, but on the source file(s) in which the
300 ‘--help’ and ‘--version’ output are defined.
302 This usage allows a manual page to be generated by the maintainer and
303 included in the distribution without requiring the end-user to have
304 ‘help2man’ installed.
306 An example rule for the program ‘prog’ could be:
308 prog.1: $(srcdir)/main.c
309 -$(HELP2MAN) --output=$@ --name='an example program' ./prog
311 The value of ‘HELP2MAN’ may be set in ‘configure.in’ using either of:
313 AM_MISSING_PROG(HELP2MAN, help2man)
317 AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //)
322 File: help2man-zh_CN.info.tmp, Node: 本地化手册页, Next: 示例, Prev: Makefile 用法, Up: Top
327 Manual pages may be produced for any locale supported by both the
328 program and ‘help2man’ with the ‘--locale’ (‘-L’) option.
330 help2man -L fr_FR@euro -o cp.fr.1 cp
332 参见 <http://translationproject.org/domain/help2man.html> 以获取
333 ‘help2man’ 目前支持的语言列表,以及 *note 报告:: 以学习如何提交其它翻译
336 6.1 Changing the Location of Message Catalogs
337 =============================================
339 When creating localised manual pages from a program’s build directory it
340 is probable that the translations installed in the standard location
341 will not be (if installed at all) correct for the version of the program
344 A preloadable library is provided with ‘help2man’ which will
345 intercept ‘bindtextdomain’ calls configuring the location of message
346 catalogs for the domain given by ‘$TEXTDOMAIN’ and override the location
347 to the path given by ‘$LOCALEDIR’.
351 mkdir -p tmp/fr/LC_MESSAGES
352 cp po/fr.gmo tmp/fr/LC_MESSAGES/PROG.mo
353 LD_PRELOAD="/usr/lib/help2man/bindtextdomain.so" \
356 help2man -L fr_FR@euro -i PROG.fr.h2m -o PROG.fr.1 PROG
359 will cause PROG to load the message catalog from ‘tmp’ rather than
363 • The generalisation of ‘fr_FR@euro’ to ‘fr’ in the example above is
364 done by ‘gettext’, if a more specific match were available it would
365 also have been re-mapped.
367 • 此预加载库只配合 ‘eglibc’ 2.11.2 和 ‘gettext’ 0.18.1.1 在一个
368 GNU/Linux 系统上测试过;请告诉我们它是否对你有用(*note 报告::)。
371 File: help2man-zh_CN.info.tmp, Node: 示例, Next: 报告, Prev: 本地化手册页, Up: Top
374 ***********************
376 Given a hypothetical program ‘foo’ which produces the following output:
381 版权所有 (C) 2011 自由软件基金会。
382 本软件为自由软件;请参阅源代码以获取许可条款。此软件不对包括商业使用以及其他
385 Written by A. Programmer.
387 GNU `foo' does nothing interesting except serve as an example for
393 -a, --option an option
394 -b, --another-option[=VALUE]
402 foo --option 效果一致,传入参数 `--option'
404 请将问题报告给 <bug-gnu-utils@gnu.org>。
406 ‘help2man’ will produce ‘nroff’ input for a manual page which will be
407 formatted something like this:
412 foo - manual page for foo 1.1
418 GNU `foo' does nothing interesting except serve as an example for
425 -b, --another-option[=VALUE]
437 the same thing, giving `--option'
440 Written by A. Programmer.
443 Report bugs to <bug-gnu-utils@gnu.org>.
446 版权所有 (C) 2011 自由软件基金会。
447 本软件为自由软件;请参阅源代码以获取许可条款。
448 此软件不对提供任何担保,甚至不保证适销性或对某一特定用途的适用性的保证。
450 The full documentation for foo is maintained as a Texinfo manual.
451 If the info and foo programs are properly installed at your site,
458 foo 1.1 2011 五月 FOO(1)
461 File: help2man-zh_CN.info.tmp, Node: 报告, Next: 可用性, Prev: 示例, Up: Top
466 如果你在此程序或本手册中发现了问题,或是有什么意见或建议,都请一并报告到
467 <bug-help2man@gnu.org>。
469 翻译员们请注意: 软件翻译通过 Translation Project
470 (http://translationproject.org/) 管理,请访问
471 <http://translationproject.org/html/translators.html> 以获取更多信息。
474 File: help2man-zh_CN.info.tmp, Node: 可用性, Prev: 报告, Up: Top
479 此发行的最新版本可从 GNU 在线镜像获取:
481 <http://ftpmirror.gnu.org/help2man/>
485 <http://www.gnu.org/order/ftp.html>
487 必要时可以使用 GNU 主 FTP 服务器:
488 <http://ftp.gnu.org/gnu/help2man/>
494 Node: 调用 help2man
\7f2610
495 Node: --help 建议
\7f5287
497 Node: Makefile 用法
\7f11016