Changed macro used for indentation.

This commit is contained in:
Juan Jose Comellas 2009-10-13 17:55:12 -03:00
parent 6cf2a8c0dd
commit 8456f1018b

View File

@ -10,7 +10,8 @@
%% @headerfile "getopt.hrl" %% @headerfile "getopt.hrl"
-define(TAB_LENGTH, 8). -define(TAB_LENGTH, 8).
-define(HELP_INDENTATION, 3 * ?TAB_LENGTH). %% Indentation of the help messages in number of tabs.
-define(INDENTATION, 3).
%% @type option() = atom() | {atom(), getopt_arg()}. Option type and optional default argument. %% @type option() = atom() | {atom(), getopt_arg()}. Option type and optional default argument.
-type option() :: atom() | {atom(), getopt_arg()}. -type option() :: atom() | {atom(), getopt_arg()}.
@ -226,7 +227,7 @@ usage_options([], Acc) ->
%% with the correct indentation. %% with the correct indentation.
add_option_help(#option{help = Help}, Prefix, Acc) when is_list(Help), Help =/= [] -> add_option_help(#option{help = Help}, Prefix, Acc) when is_list(Help), Help =/= [] ->
FlatPrefix = lists:flatten(Prefix), FlatPrefix = lists:flatten(Prefix),
case (?HELP_INDENTATION - 2 - length(FlatPrefix)) of case ((?INDENTATION * ?TAB_LENGTH) - 2 - length(FlatPrefix)) of
TabSize when TabSize > 0 -> TabSize when TabSize > 0 ->
Tab = lists:duplicate(ceiling(TabSize / ?TAB_LENGTH), $\t), Tab = lists:duplicate(ceiling(TabSize / ?TAB_LENGTH), $\t),
[[$\s, $\s, FlatPrefix, Tab, Help, $\n] | Acc]; [[$\s, $\s, FlatPrefix, Tab, Help, $\n] | Acc];