Skip to content

Commit

Permalink
MODIFIED: argv_options/3: with type (bool|sometype)
Browse files Browse the repository at this point in the history
We now consider the option boolean unless written as ``--opt=value``
Before, the option was considered boolean if it was the last argument
or the next argument started with a `-`.
  • Loading branch information
JanWielemaker committed Sep 19, 2024
1 parent 6b87654 commit 3c972ec
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions library/main.pl
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
% Disjunctive type. Disjunction can be used create long
% options with optional values. For example, using the type
% ``nonneg|boolean``, for an option `http` handles ``--http``
% as http(true), ``--no-http`` as http(false), ``--http=3000``
% and ``--http 3000`` as http(3000). With an optional boolean
% an option is considered boolean if it is the last or the next
% argument starts with a hyphen (``-``).
% as http(true), ``--no-http`` as http(false) and ``--http=3000``
% as http(3000). Note that with an optional boolean a option is
% considered boolean unless it has a value written as
% ``--longopt=value``.
% - boolean(Default)
% - boolean
% Boolean options are special. They do not take a value except
Expand Down Expand Up @@ -411,11 +411,6 @@
take_long_(Long, T, Positional, Options, M, POptions) :- % --long [value]
in(M:opt_type(Long, Name, Type)),
type_optional_bool(Type, Value),
( T = [VAtom|_],
sub_atom(VAtom, 0, _, _, -)
-> true
; T == []
),
!,
Opt =.. [Name,Value],
Options = [Opt|OptionsT],
Expand Down

0 comments on commit 3c972ec

Please sign in to comment.