Added edoc comments.
This commit is contained in:
parent
35395b82e8
commit
cc6bf5810a
@ -2,24 +2,31 @@
|
||||
%%% @author Juan Jose Comellas <jcomellas@novamens.com>
|
||||
%%% @copyright (C) 2009, Novamens SA (http://www.novamens.com)
|
||||
%%% @doc Parses command line options with a format similar to that of GNU getopt.
|
||||
%%% @end
|
||||
%%%-------------------------------------------------------------------
|
||||
-module(getopt).
|
||||
|
||||
%% @headerfile getopt.hrl
|
||||
-include("getopt.hrl").
|
||||
|
||||
-define(TAB_LENGTH, 8).
|
||||
-define(HELP_INDENTATION, 4 * ?TAB_LENGTH).
|
||||
|
||||
-type option() :: atom() | {atom(), any()}.
|
||||
%% @type option() = atom() | {atom(), getopt_arg()}. Option type and optional default argument.
|
||||
-type option() :: atom() | {atom(), getopt_arg()}.
|
||||
%% @type option_spec() = [#option{}]. Command line options specification.
|
||||
-type option_spec() :: [#option{}].
|
||||
%% @type option_list() = [option()]. List of option types.
|
||||
-type option_list() :: [option()].
|
||||
-type arg_list() :: [atom() | binary() | boolean() | float() | integer() | string()].
|
||||
%% @type arg_list() = [getopt_arg()]. List of arguments returned to the calling function.
|
||||
-type arg_list() :: [getopt_arg()].
|
||||
|
||||
-export([parse/2, usage/2]).
|
||||
|
||||
|
||||
-spec parse(option_spec(), [string()]) -> option_list().
|
||||
%%--------------------------------------------------------------------
|
||||
%% @spec parse(OptSpec::option_spec(), Args::[string()]) -> option_list().
|
||||
%% @doc Parse the command line options and arguments returning a list of tuples
|
||||
%% and/or atoms using the Erlang convention for sending options to a
|
||||
%% function.
|
||||
@ -157,6 +164,7 @@ to_type(_Type, Arg) ->
|
||||
|
||||
-spec usage(option_spec(), string()) -> ok.
|
||||
%%--------------------------------------------------------------------
|
||||
%% @spec usage(OptSpec :: option_spec(), ProgramName :: string()) -> ok.
|
||||
%% @doc Show a message on stdout indicating the command line options and
|
||||
%% arguments that are supported by the program.
|
||||
%%--------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user