开源夏令营之foldcolumn工具及解决方案--学习制作manpage
来源:互联网 发布:淘宝卖京东e卡 骗局 编辑:程序博客网 时间:2024/06/17 19:54
Link:how to create a man page
how do I create a man page for my shell or python script under Linux / UNIX operating systems?Almost all UNIX like oses comes preinstalled with man pages.
Troff and Groff Macro
troff is a document processing system developed by AT&T for the Unix operating system. The troff typesetting system includes sets of commands called macros that are run before starting to process the document. These macros include setting up page headers and footers, defining new commands, and generally influencing how the output will be formatted. Under Linux all new manual pages should be marked up using the groff an.tmac package. The groff (GNU troff) software is a typesetting package which reads plain text mixed with formatting commands and produces formatted output.
A Quick Note About Man Page Layout
All man pages follow a common layout and it is recommend that you use the same for your man pages too:
NAME The name of the command or function, followed by a one-line description of what it does.SYNOPSIS In the case of a command, you get a formal description of how to run it and what command line options it takes.DESCRIPTION A textual description of the functioning of the command or function.EXAMPLES Some examples of common usage.SEE ALSO A list of related commands or functions.BUGS List known bugs.AUTHOR Specify your contact information.COPYRIGHT Specify your copyright information.You can add a few more other sections such as EXIT STATUS, ENVIRONMENT, FILES, and HISTORY etc. The table below shows the section numbers of the manual followed by the types of pages they contain (man man).
Man Page Sections
The manual is generally split into eight numbered sections, organized as follows under Linux or UNIX like oses:
man man
Man page Location
(see /etc/man.config)
The system stores its man pages at /usr/share/man/ directory as described in about section. For example, the directory /usr/share/man/man1 stores man pages for user shell commands. You can view it by typing the following command:
cd /usr/share/man/man1ls -lzcat ls.1.gz
Custom Man Page Location
It is recommended that you store your own man pages in /usr/local/man directory. You can set man search path in /etc/man.config file:
MANPATH /usr/manMANPATH /usr/share/manMANPATH /usr/local/manMANPATH /usr/local/share/manMANPATH /usr/X11R6/man
See manpath man page for more details about how to determine search path for manual pages:
man manpath
How Do I Create My Own Man Page?
The groff (GNU Troff) software is a typesetting package which reads plain text mixed with formatting commands and produces formatted output such as man page. It comes with various macro packages such as man and mandoc to create man pages. Create a file as follows
$ vi nuseradd
.\" Manpage for nuseradd..\" Contact vivek@nixcraft.net.in to correct errors or typos..TH nuseradd 8 "06 May 2010" "1.0" "nuseradd man page".SH NAMEnuseradd \- create a new LDAP user.SH SYNOPSISnuseradd [USERNAME].SH DESCRIPTIONnuseradd is high level shell program for adding users to LDAP server. On Debian, administrators should usually use nuseradd.debian(8) instead..SH OPTIONSThe nuseradd does not take any options. However, you can supply username..SH SEE ALSOuseradd(8), passwd(5), nuseradd.debian(8).SH BUGSNo known bugs..SH AUTHORVivek Gite (vivek@nixcraft.net.in)Save and close the file. To view your man page, enter:
man ./nuseraddSample outputs:
The .TH macro introduces a manual page (e.g., set man page title and section). Section headers, paragraph breaks, lists and displays etc displayed using .SH macro. See the following man page which describes all macros:
man 7 mdoc
How Do I Install My Man Page?
Simply type the following command:
cp nuseradd /usr/local/man/man8/nuseradd.1gzip /usr/local/man/man8/nuseradd.1man nuseradd
(gzip is not must)
You can also use install command as follows (recommend for shell scripts):
install -g 0 -o 0 -m 0644 nuseradd.1 /usr/local/man/man8/gzip /usr/local/man/man8/nuseradd.1
Reference
GNUTroff(Groff)- a GNU project.
see man page mdoc,groff,and install commands.
manpage wiki
- 开源夏令营之foldcolumn工具及解决方案--学习制作manpage
- 开源夏令营之foldcolumn工具及解决方案(六)制作manpage与Makefile
- 开源夏令营之foldcolumn工具及解决方案(一)
- 开源夏令营之foldcolumn工具及解决方案之box-drawing character
- 开源夏令营之foldcolumn工具及解决方案之获取终端宽度
- 开源夏令营之foldcolumn工具及解决方案(二)确定表格属性、绘制表格
- 开源夏令营之foldcolumn工具及解决方案(三)表格列超长自动换行实现
- 开源夏令营之foldcolumn工具及解决方案之中期总结
- 开源夏令营之foldcolumn工具及解决方案(四)数值精度与对齐方式处理
- 开源夏令营之foldcolumn工具及解决方案(五)数值精度处理实现
- 开源夏令营之foldcolumn工具及解决方案(七)测试与总结
- 开源夏令营之项目汇报1
- 开源夏令营之项目汇报2
- 开源夏令营之项目汇报3
- 开源夏令营之项目汇报4
- 开源夏令营之项目汇报5
- 开源夏令营之项目汇报7
- 开源夏令营之项目汇报8
- mainframe、z/OS、cobol、jcl的关系
- 队列
- Codeforces Round #260 (Div. 2)B. Fedya and Maths
- Cocos2d-x能够实现的效果总结 (2013-09-03 15:41:47)
- 快速排序-两种常见的划分
- 开源夏令营之foldcolumn工具及解决方案--学习制作manpage
- Compiling and linking error when using NDK r10 to build cocos2d-x v3.2
- IAR扩展关键字
- Android Theme
- 【KMP】模板
- Android OpenGL ES 开发教程(1):导言
- //淡入动画:渐渐显现的动画.
- hdu 1698 Just a Hook(线段树之 成段更新)
- hdu 2082 母函数