GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
CLARG_COUNTER
+
Point of view
COMMAND_LINE_ARGUMENTS
ANY
INTERNALS_HANDLER
TYPED_INTERNALS
COMMAND_LINE_ARGUMENTS
COMMAND_LINE_ARGUMENT
All features
class CLARG_COUNTER
Summary
top
Direct parents
Inherit list:
COMMAND_LINE_TYPED_ARGUMENT
Insert list:
ARGUMENTS
,
CLARG_OPTIONS
Class invariant
top
is_optional
is_optional or else is_positional or else is_mandatory
Overview
top
Creation features
Exported features
item
:
INTEGER_32
The argument value, if
is_set
usage
:
FIXED_STRING
The option usage
is_mandatory
:
BOOLEAN
True if the argument must be set at least once.
can_be_mandatory
:
BOOLEAN
True if the argument can be
set_mandatory
(True).
is_optional
:
BOOLEAN
True if the argument may not be set.
can_be_optional
:
BOOLEAN
True if the argument can be
set_mandatory
(False).
is_positional
:
BOOLEAN
True if the argument is not introduced by a flag.
is_repeatable
:
BOOLEAN
True if the argument is repeatable; False if unique.
is_set
:
BOOLEAN
True if the option is present and correct.
force_index
(a_index:
INTEGER_32
)
Force a positional parameter to be valid only at the given index
out_in_tagged_out_memory
Append terse printable representation of current object in
tagged_out_memory
.
prepare_parse
parse_command_line
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
usage_summary
(stream:
OUTPUT_STREAM
)
usage_details
(stream:
OUTPUT_STREAM
)
set_mandatory
(parent_option: CLARG_COUNTER, enable:
BOOLEAN
)
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
True if the option is present and correct at the given context.
undo_parse
(context:
COMMAND_LINE_CONTEXT
)
as_mandatory
: CLARG_COUNTER
Make the option mandatory (default for positionals)
prefix "+"
: CLARG_COUNTER
Make the option mandatory (default for positionals)
as_optional
: CLARG_COUNTER
Make the option optional (default for options)
prefix "-"
: CLARG_COUNTER
Make the option optional (default for options)
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
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)
argument_count
:
INTEGER_32
Number of arguments given to command that started system execution (command name does not count).
argument
(i:
INTEGER_32
):
STRING
i
th argument of command that started system execution Gives the command name if
i
is 0.
command_name
:
STRING
item
:
INTEGER_32
effective function
top
The argument value, if
is_set
usage
:
FIXED_STRING
writable attribute
top
The option usage
is_mandatory
:
BOOLEAN
is False
constant attribute
top
True if the argument must be set at least once.
ensure
Result implies can_be_mandatory
can_be_mandatory
:
BOOLEAN
is False
constant attribute
top
True if the argument can be
set_mandatory
(True).
is_optional
:
BOOLEAN
is True
constant attribute
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
can_be_optional
:
BOOLEAN
is True
constant attribute
top
True if the argument can be
set_mandatory
(False).
is_positional
:
BOOLEAN
is False
constant attribute
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
is_repeatable
:
BOOLEAN
is True
constant attribute
top
True if the argument is repeatable; False if unique.
is_set
:
BOOLEAN
effective function
top
True if the option is present and correct.
force_index
(a_index:
INTEGER_32
)
effective procedure
top
Force a positional parameter to be valid only at the given index
require
a_index > 0
is_positional
not is_repeatable
out_in_tagged_out_memory
effective procedure
top
Append terse printable representation of current object in
tagged_out_memory
.
prepare_parse
effective procedure
top
ensure
not is_set
parse_command_line
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
effective function
top
require
context.is_parsed
usage_summary
(stream:
OUTPUT_STREAM
)
effective procedure
top
usage_details
(stream:
OUTPUT_STREAM
)
effective procedure
top
set_mandatory
(parent_option: CLARG_COUNTER, enable:
BOOLEAN
)
effective procedure
top
require
parent_option /= Void
enable /= is_mandatory
enable implies can_be_mandatory
not enable implies can_be_optional
ensure
is_mandatory = enable
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
effective function
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
undo_parse
(context:
COMMAND_LINE_CONTEXT
)
effective procedure
top
require
is_set_at(context)
ensure
not is_set_at(context)
not is_repeatable implies not is_set
as_mandatory
: CLARG_COUNTER
effective function
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
prefix "+"
: CLARG_COUNTER
effective function
top
Make the option mandatory (default for positionals)
require
can_be_mandatory
ensure
Result.
is_mandatory
as_optional
: CLARG_COUNTER
effective function
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
prefix "-"
: CLARG_COUNTER
effective function
top
Make the option optional (default for options)
require
can_be_optional
ensure
not Result.
is_mandatory
short
:
FIXED_STRING
deferred function
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
top
The long option flag introducing the argument, Void for positionals
ensure
is_positional
implies Result = Void
Result /= Void implies not Result.is_empty
infix "or"
(other:
COMMAND_LINE_ARGUMENT
):
COMMAND_LINE_ARGUMENT
effective function
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
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
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
top
Arguments conjunction.
All the arguments are checked, in any order.
require
other /= Void
ensure
Result /= Void
prefix "not"
:
COMMAND_LINE_ARGUMENT
effective function
top
(tentative; don't use it, the semantics is not well defined)
ensure
Result /= Void
argument_count
:
INTEGER_32
effective function
top
Number of arguments given to command that started system execution (command name does not count).
ensure
Result >= 0
argument
(i:
INTEGER_32
):
STRING
effective function
top
i
th argument of command that started system execution Gives the command name if
i
is 0.
require
i >= 0
i <=
argument_count
ensure
Result /= Void
command_name
:
STRING
effective function
top