我正在寻找某种格式来描述 shell 脚本中的函数。
例如。在 PHP 中:
/**
* My description
*
* @param string $paramOne Some extra comment for this parameter
* @param int $paramTwo
* @return $this
*/
function myCoolFunc($paramOne, $paramTwo)
{
}
有文档格式吗?
UPD 1 我不是在寻找文档处理器。只是格式化。
应该是这样的:
# Simple yes/no dialog question
#
# e.g.: $(dialog_yes_no 'Would like to repeat?' 'n' 3)
#
# string question
# string default
# int mistakes_count = 5
function dialog_yes_no
{
}
我确实使用以下格式,你可以开始使用这种格式,它类似于 unix/linux 使用的 man/info。
#!/bin/ksh
#================================================================
# HEADER
#================================================================
#% SYNOPSIS
#+ ${SCRIPT_NAME} [-hv] [-o[file]] args ...
#%
#% DESCRIPTION
#% This is a script template
#% to start any good shell script.
#%
#% OPTIONS
#% -o [file], --output=[file] Set log file (default=/dev/null)
#% use DEFAULT keyword to autoname file
#% The default value is /dev/null.
#% -t, --timelog Add timestamp to log ("+%y/%m/%d@%H:%M:%S")
#% -x, --ignorelock Ignore if lock file exists
#% -h, --help Print this help
#% -v, --version Print script information
#%
#% EXAMPLES
#% ${SCRIPT_NAME} -o DEFAULT arg1 arg2
#%
#================================================================
#- IMPLEMENTATION
#- version ${SCRIPT_NAME} (www.uxora.com) 0.0.4
#- author Michel VONGVILAY
#- copyright Copyright (c) http://www.uxora.com
#- license GNU General Public License
#- script_id 12345
#-
#================================================================
# HISTORY
# 2015/03/01 : mvongvilay : Script creation
# 2015/04/01 : mvongvilay : Add long options and improvements
#
#================================================================
# DEBUG OPTION
# set -n # Uncomment to check your syntax, without execution.
# set -x # Uncomment to debug this shell script
#
#================================================================
# END_OF_HEADER
#================================================================