anchor.diff:      OptAcc.
   
   
  --spec convert_option_no_arg(option_spec()) -> compound_option().
  -convert_option_no_arg({Name, _Short, _Long, ArgSpec, _Help}) ->
  -    case ArgSpec of
  -        % Special case for booleans: if there is no argument we assume
  -        % the value is 'true'.
  -        {boolean, _DefaultValue} ->
  -            {Name, true};
  +%% @doc Add an option with no argument.
  +-spec add_option_no_arg(option_spec(), [option()]) -> [option()].
  +add_option_no_arg({Name, _Short, _Long, ArgSpec, _Help} = OptSpec, OptAcc) ->
  +    case arg_spec_type(ArgSpec) of
           boolean ->
  -            {Name, true};
  +            %% Special case for boolean arguments: if there is no argument we
  +            %% set the value to 'true'.
  +            add_arg(OptSpec, true, OptAcc);
  +        integer ->
  +            %% Special case for integer arguments: if the option had not been set
  +            %% before we set the value to 1; if not we increment the previous value
  +            %% the option had. This is needed to support options like "-vvv" to
  +            %% return something like {verbose, 3}.
  +            add_implicit_integer_arg(OptSpec, OptAcc);
           _ ->
               throw({error, {missing_option_arg, Name}})
       end.
   
   
  -%% @doc Convert the argument passed in the command line to the data type
  -%%      indicated by the argument specification.
  --spec convert_option_arg(option_spec(), string()) -> compound_option().
  -convert_option_arg({Name, _Short, _Long, ArgSpec, _Help}, Arg) ->
  -    try
  -        {Name, to_type(arg_spec_type(ArgSpec), Arg)}
  -    catch
  -        error:_ ->
  -            throw({error, {invalid_option_arg, {Name, Arg}}})
  -    end.
  +%% @doc Add an option with argument converting it to the data type indicated by the
  +%%      argument specification.
  +-spec add_option_arg(option_spec(), string(), [option()]) -> [option()].
  +add_option_arg({Name, _Short, _Long, ArgSpec, _Help} = OptSpec, Arg, OptAcc) ->
  +    ArgSpecType = arg_spec_type(ArgSpec),
  +    case (ArgSpecType =:= boolean) andalso not is_boolean_arg(Arg) of
  +        true ->
  +            %% Special case for booleans: when the next string is not a boolean
  +            %% argument we assume the value is 'true'.
  +            add_arg(OptSpec, true, OptAcc);
  +        false ->
  +            case (ArgSpecType =:= integer) andalso not is_integer_arg(Arg) of
  +                true ->
  +                    %% Special case for integer arguments: if the option had not been set
  +                    %% before we set the value to 1; if not we increment the previous value
  +                    %% the option had. This is needed to support options like "-vvv" to
  +                    %% return something like {verbose, 3}.
  +                    add_implicit_integer_arg(OptSpec, OptAcc);
  +                false ->
  +                    try
  +                       add_arg(OptSpec, to_type(ArgSpecType, Arg), OptAcc)
  +                    catch
  +                        error:_ ->
  +                            throw({error, {invalid_option_arg, {Name, Arg}}})
  +                    end
  +            end
  +    end.
  +
  +
  +%% Add an option with an integer argument.
  +-spec add_implicit_integer_arg(option_spec(), [option()]) -> [option()].
  +add_implicit_integer_arg({Name, _Short, _Long, _ArgSpec, _Help}, OptAcc) ->
  +    case lists:keyfind(Name, 1, OptAcc) of
  +        {Name, Count} ->
  +            lists:keyreplace(Name, 1, OptAcc, {Name, Count + 1});
  +        false ->
  +            [{Name, 1} | OptAcc]
  +    end.
  +
  +
  +%% @doc Add an option with an argument and convert it to the data type corresponding
  +%%      to the argument specification.
  +-spec add_arg(option_spec(), arg_value(), [option()]) -> [option()].
  +add_arg({Name, _Short, _Long, _ArgSpec, _Help}, Arg, OptAcc) ->
  +    [{Name, Arg} | lists:keydelete(Name, 1, OptAcc)].
   
   
   %% @doc Retrieve the data type form an argument specification.
  
positive.code:                    ArgSpec :: arg_spec(),
                     Help    :: string() | undefined
                    }.
  
  
  %% @doc  Parse the command line options and arguments returning a list of tuples
  
negative.code: %%        -afoo    Single option 'a', argument "foo"
  %%        -abc     Multiple options: 'a'; 'b'; 'c'
  %%        -bcafoo  Multiple options: 'b'; 'c'; 'a' with argument "foo"
  %%        -aaa     Multiple repetitions of option 'a' (only valid for options with integer arguments)
  -spec parse_option_short([option_spec()], [option()], [string()], integer(), [string()], string(), string()) ->
      {ok, {[option()], [string()]}}.
  parse_option_short(OptSpecList, OptAcc, ArgAcc, ArgPos, Args, OptStr, [Short | Arg]) ->
  