GNU
|
Liberty Eiffel
|
Automated Tests
|
Wiki
|
Savannah project
|
Debian packages
|
Documentation
>
libraries
>
CLARG_PARSER
+
Point of view
All features
ANY
COMMAND_LINE_ARGUMENTS
COMMAND_LINE_ARGUMENT
CLARG_PARSER
All features
deferred class CLARG_PARSER
Summary
top
Direct parents
Insert list:
ARGUMENTS
,
CLARG_OPTIONS
Known children
Insert list:
CLARG_WITH_ARG
,
CLARG_WITH_ARGS
Class invariant
top
short
/= Void implies
short
.count = 1
Overview
top
Features
{
ANY
}
name
:
FIXED_STRING
usage
:
FIXED_STRING
index
:
INTEGER_32
is_mandatory
:
BOOLEAN
is_set
:
BOOLEAN
force_index
(a_index:
INTEGER_32
)
is_optional
:
BOOLEAN
is_positional
:
BOOLEAN
can_be_mandatory
:
BOOLEAN
can_be_optional
:
BOOLEAN
out_in_tagged_out_memory
Append terse printable representation of current object in
tagged_out_memory
.
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
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_PARSER, enable:
BOOLEAN
)
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
parsing
{}
parse_positional
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
parse_short
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
parse_long
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
{
CLARG_PARSER
}
set_data_
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
is_valid_data
(data:
STRING
):
BOOLEAN
{}
set_data
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
{}
optional
(a_short:
ABSTRACT_STRING
, a_long:
ABSTRACT_STRING
, a_name:
ABSTRACT_STRING
, a_usage:
ABSTRACT_STRING
)
positional
(a_name:
ABSTRACT_STRING
, a_usage:
ABSTRACT_STRING
)
parent
: CLARG_PARSER
{}
detailed
:
BOOLEAN
{
ANY
}
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
{}
command_arguments
:
FAST_ARRAY
[
STRING
]
Give access to arguments command line including the command name at index 0.
Implementation of
ARGUMENTS
(do not use directly):
{}
se_argc
:
INTEGER_32
To implement
command_arguments
se_argv
(i:
INTEGER_32
):
STRING
To implement
command_arguments
{
ANY
}
short
:
FIXED_STRING
long
:
FIXED_STRING
patterns
{}
short_pattern
:
REGULAR_EXPRESSION
long_pattern
:
REGULAR_EXPRESSION
long_equal_pattern
:
REGULAR_EXPRESSION
queries
{}
is_short
(arg:
STRING
, a_index:
INTEGER_32
):
BOOLEAN
is_long
(arg:
STRING
):
BOOLEAN
is_long_equal
(arg:
STRING
):
BOOLEAN
usage output helpers
{}
put_short
(stream:
OUTPUT_STREAM
)
put_long
(stream:
OUTPUT_STREAM
)
name
:
FIXED_STRING
writable attribute
{
ANY
}
top
usage
:
FIXED_STRING
writable attribute
{
ANY
}
top
index
:
INTEGER_32
writable attribute
{
ANY
}
top
is_mandatory
:
BOOLEAN
writable attribute
{
ANY
}
top
is_set
:
BOOLEAN
deferred function
{
ANY
}
top
force_index
(a_index:
INTEGER_32
)
effective procedure
{
ANY
}
top
ensure
index
= a_index
is_optional
:
BOOLEAN
effective function
{
ANY
}
top
is_positional
:
BOOLEAN
effective function
{
ANY
}
top
can_be_mandatory
:
BOOLEAN
is True
constant attribute
{
ANY
}
top
can_be_optional
:
BOOLEAN
effective function
{
ANY
}
top
out_in_tagged_out_memory
effective procedure
{
ANY
}
top
Append terse printable representation of current object in
tagged_out_memory
.
require
locked:
tagged_out_locked
locked:
tagged_out_locked
ensure
still_locked:
tagged_out_locked
not_cleared:
tagged_out_memory.count >= old tagged_out_memory.count
append_only:
old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
parse_command_line
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
effective function
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
usage_summary
(stream:
OUTPUT_STREAM
)
effective procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
usage_details
(stream:
OUTPUT_STREAM
)
effective procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
set_mandatory
(parent_option: CLARG_PARSER, enable:
BOOLEAN
)
effective procedure
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
is_set_at
(context:
COMMAND_LINE_CONTEXT
):
BOOLEAN
deferred function
{
COMMAND_LINE_ARGUMENTS
,
COMMAND_LINE_ARGUMENT
}
top
parse_positional
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
effective function
{}
top
require
is_positional
parse_short
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
effective function
{}
top
require
not
is_positional
short
/= Void
parse_long
(context:
COMMAND_LINE_CONTEXT
):
COMMAND_LINE_CONTEXT
effective function
{}
top
require
not
is_positional
long
/= Void
set_data_
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
effective procedure
{
CLARG_PARSER
}
top
require
is_valid_data
(data)
parent
/= Void implies
parent
.
is_valid_data
(data)
is_valid_data
(data:
STRING
):
BOOLEAN
deferred function
{
CLARG_PARSER
}
top
set_data
(context:
COMMAND_LINE_CONTEXT
, data:
STRING
)
deferred procedure
{}
top
require
is_valid_data
(data)
ensure
is_set_at
(context)
optional
(a_short:
ABSTRACT_STRING
, a_long:
ABSTRACT_STRING
, a_name:
ABSTRACT_STRING
, a_usage:
ABSTRACT_STRING
)
effective procedure
{}
top
require
a_short /= Void implies a_short.count = 1
a_short /= Void or else a_long /= Void
a_name /= Void
ensure
is_optional
a_short /= Void implies
short
.is_equal(a_short)
a_long /= Void implies
long
.is_equal(a_long)
name
.is_equal(a_name)
a_usage /= Void implies
usage
.is_equal(a_usage)
positional
(a_name:
ABSTRACT_STRING
, a_usage:
ABSTRACT_STRING
)
effective procedure
{}
top
require
a_name /= Void
ensure
is_positional
is_mandatory
name
.is_equal(a_name)
a_usage /= Void implies
usage
.is_equal(a_usage)
parent
: CLARG_PARSER
writable attribute
{}
top
detailed
:
BOOLEAN
writable attribute
{}
top
argument_count
:
INTEGER_32
effective function
{
ANY
}
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
{
ANY
}
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
{
ANY
}
top
command_arguments
:
FAST_ARRAY
[
STRING
]
frozen
once function
{}
top
Give access to arguments command line including the command name at index 0.
This is a once function, so you can modify command-line arguments! (NOTE: just be sure not to remove the first argument, although you may change it)
ensure
not Result.is_empty
se_argc
:
INTEGER_32
{}
top
To implement
command_arguments
se_argv
(i:
INTEGER_32
):
STRING
{}
top
To implement
command_arguments
short
:
FIXED_STRING
writable attribute
{
ANY
}
top
long
:
FIXED_STRING
writable attribute
{
ANY
}
top
short_pattern
:
REGULAR_EXPRESSION
once function
{}
top
long_pattern
:
REGULAR_EXPRESSION
once function
{}
top
long_equal_pattern
:
REGULAR_EXPRESSION
once function
{}
top
is_short
(arg:
STRING
, a_index:
INTEGER_32
):
BOOLEAN
effective function
{}
top
require
short
/= Void
is_long
(arg:
STRING
):
BOOLEAN
effective function
{}
top
require
long
/= Void
is_long_equal
(arg:
STRING
):
BOOLEAN
effective function
{}
top
require
long
/= Void
ensure
Result implies
long_equal_pattern
.named_group_matched("value")
put_short
(stream:
OUTPUT_STREAM
)
effective procedure
{}
top
require
short
/= Void
put_long
(stream:
OUTPUT_STREAM
)
effective procedure
{}
top
require
long
/= Void