GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
COMMAND_LINE_TYPED_ARGUMENT
+
Point of view
All features
ANY
COMMAND_LINE_ARGUMENTS
COMMAND_LINE_ARGUMENT
All features
deferred class COMMAND_LINE_TYPED_ARGUMENT [E_]
Summary
top
A
"single"
argument which bears a value aka
item
.
Direct parents
Inherit list:
COMMAND_LINE_ARGUMENT
Known children
Inherit list:
CLARG_BOOLEAN
,
CLARG_COUNTER
,
CLARG_REMAINING
,
CLARG_WITH_ARG
,
CLARG_WITH_ARGS
Class invariant
top
is_optional
or else
is_positional
or else
is_mandatory
Overview
top
Features
{
ANY
}
item
: E_
The argument value, if
is_set
as_mandatory
: COMMAND_LINE_TYPED_ARGUMENT [E_]
Make the option mandatory (default for positionals)
prefix "+"
: COMMAND_LINE_TYPED_ARGUMENT [E_]
Make the option mandatory (default for positionals)
as_optional
: COMMAND_LINE_TYPED_ARGUMENT [E_]
Make the option optional (default for options)
prefix "-"
: COMMAND_LINE_TYPED_ARGUMENT [E_]
Make the option optional (default for options)
{
ANY
}
is_mandatory
:
BOOLEAN
True if the argument must be set at least once.
is_optional
:
BOOLEAN
True if the argument may not be set.
is_positional
:
BOOLEAN
True if the argument is not introduced by a flag.
can_be_mandatory
:
BOOLEAN
True if the argument can be
set_mandatory
(True).
can_be_optional
:
BOOLEAN
True if the argument can be
set_mandatory
(False).
{
ANY
}
short
:
FIXED_STRING
The short (one-letter) option flag introducing the argument, Void for positionals
long
:
FIXED_STRING
The long option flag introducing the argument, Void for positionals
usage
:
FIXED_STRING
The option usage
force_index
(a_index:
INTEGER_32
)
Force a positional parameter to be valid only at the given index
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
set_mandatory
(parent_option: COMMAND_LINE_TYPED_ARGUMENT [E_], enable:
BOOLEAN
)
{}
parent
: COMMAND_LINE_TYPED_ARGUMENT [E_]
Internal technical trick to ensure that arguments with a non-standard behaviour (
set_mandatory
) are correctly managed.
{
ANY
}
infix "or"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments disjunction.
infix "or else"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments disjunction.
infix "and"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments conjunction.
infix "and then"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
Arguments conjunction.
prefix "not"
:
COMMAND_LINE_ARGUMENT
(tentative; don't use it, the semantics is not well defined)
{
ANY
}
is_set
:
BOOLEAN
True if the option is present and correct.
is_repeatable
:
BOOLEAN
True if the argument is repeatable; False if unique.
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
prepare_parse
parse_command_line
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
undo_parse
(context:
COMMAND_LINE_CONTEXT
)
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
True if the option is present and correct at the given context.
usage_summary
(stream:
OUTPUT_STREAM
)
usage_details
(stream:
OUTPUT_STREAM
)
{}
detailed
:
BOOLEAN
item
: E_
deferred function
{
ANY
}
top
The argument value, if
is_set
as_mandatory
: COMMAND_LINE_TYPED_ARGUMENT [E_]
effective function
{
ANY
}
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
prefix "+"
: COMMAND_LINE_TYPED_ARGUMENT [E_]
effective function
{
ANY
}
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
as_optional
: COMMAND_LINE_TYPED_ARGUMENT [E_]
effective function
{
ANY
}
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
prefix "-"
: COMMAND_LINE_TYPED_ARGUMENT [E_]
effective function
{
ANY
}
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
is_mandatory
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument must be set at least once.
ensure
Result implies
can_be_mandatory
is_optional
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument may not be set.
ensure
Result implies not
is_positional
is_mandatory
implies not Result
Result implies
can_be_optional
is_positional
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument is not introduced by a flag.
Such an argument is mandatory and may have an explicit position on the command line (see
force_index
).
ensure
Result implies not
is_optional
Result implies
is_mandatory
can_be_mandatory
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument can be
set_mandatory
(True).
can_be_optional
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument can be
set_mandatory
(False).
short
:
FIXED_STRING
deferred function
{
ANY
}
top
The short (one-letter) option flag introducing the argument, Void for positionals
ensure
is_positional
implies Result = Void
Result /= Void implies Result.count = 1
long
:
FIXED_STRING
deferred function
{
ANY
}
top
The long option flag introducing the argument, Void for positionals
ensure
is_positional
implies Result = Void
Result /= Void implies not Result.is_empty
usage
:
FIXED_STRING
deferred function
{
ANY
}
top
The option usage
force_index
(a_index:
INTEGER_32
)
deferred procedure
{
ANY
}
top
Force a positional parameter to be valid only at the given index
require
a_index > 0
is_positional
not
is_repeatable
set_mandatory
(parent_option: COMMAND_LINE_TYPED_ARGUMENT [E_], enable:
BOOLEAN
)
deferred procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
require
parent_option /= Void
enable /=
is_mandatory
enable implies
can_be_mandatory
not enable implies
can_be_optional
ensure
parent
= parent_option
is_mandatory
= enable
parent
: COMMAND_LINE_TYPED_ARGUMENT [E_]
deferred function
{}
top
Internal technical trick to ensure that arguments with a non-standard behaviour (
set_mandatory
) are correctly managed.
infix "or"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
{
ANY
}
top
Arguments disjunction.
Useful to implement mutually exclusive sets of arguments.
require
other /= Void
ensure
Result /= Void
infix "or else"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
{
ANY
}
top
Arguments disjunction.
Useful to implement mutually exclusive sets of arguments.
require
other /= Void
ensure
Result /= Void
infix "and"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
{
ANY
}
top
Arguments conjunction.
All the arguments are checked, in any order.
require
other /= Void
ensure
Result /= Void
infix "and then"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
{
ANY
}
top
Arguments conjunction.
All the arguments are checked, in any order.
require
other /= Void
ensure
Result /= Void
prefix "not"
:
COMMAND_LINE_ARGUMENT
effective function
{
ANY
}
top
(tentative; don't use it, the semantics is not well defined)
ensure
Result /= Void
is_set
:
BOOLEAN
deferred function
{
ANY
}
top
True if the option is present and correct.
is_repeatable
:
BOOLEAN
deferred function
{
ANY
}
top
True if the argument is repeatable; False if unique.
prepare_parse
deferred procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
ensure
not
is_set
parse_command_line
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
deferred function
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
require
context.is_parsed
undo_parse
(context:
COMMAND_LINE_CONTEXT
)
deferred procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
require
is_set_at
(context)
ensure
not
is_set_at
(context)
not
is_repeatable
implies not
is_set
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
deferred function
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
True if the option is present and correct at the given context.
require
context.is_parsed
ensure
Result implies
is_set
not
is_repeatable
implies Result =
is_set
usage_summary
(stream:
OUTPUT_STREAM
)
deferred procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
ensure
not
detailed
usage_details
(stream:
OUTPUT_STREAM
)
deferred procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
ensure
detailed
detailed
:
BOOLEAN
deferred function
{}
top