Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
6de24d09
Commit
6de24d09
authored
Oct 30, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to suppress help generation in extract_opts
parent
579b6fa2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
libcaf_core/caf/message.hpp
libcaf_core/caf/message.hpp
+6
-3
libcaf_core/caf/message_builder.hpp
libcaf_core/caf/message_builder.hpp
+3
-3
libcaf_core/src/message.cpp
libcaf_core/src/message.cpp
+2
-2
No files found.
libcaf_core/caf/message.hpp
View file @
6de24d09
...
...
@@ -227,13 +227,16 @@ public:
/// }
/// ~~~
/// @param xs List of argument descriptors.
/// @param f Optional factory function to generate help text
/// (overrides the default generator).
/// @param help_generator Optional factory function to generate help text
/// (overrides the default generator).
/// @param suppress_help Suppress generation of default-generated help option.
/// @returns A struct containing remainder
/// (i.e. unmatched elements), a set containing the names of all
/// used arguments, and the generated help text.
/// @throws std::invalid_argument if no name or more than one long name is set
cli_res
extract_opts
(
std
::
vector
<
cli_arg
>
xs
,
help_factory
f
=
nullptr
)
const
;
cli_res
extract_opts
(
std
::
vector
<
cli_arg
>
xs
,
help_factory
help_generator
=
nullptr
,
bool
suppress_help
=
false
)
const
;
/// Queries whether the element at position `p` is of type `T`.
template
<
class
T
>
...
...
libcaf_core/caf/message_builder.hpp
View file @
6de24d09
...
...
@@ -85,9 +85,9 @@ public:
/// @copydoc message::extract_opts
inline
message
::
cli_res
extract_opts
(
std
::
vector
<
message
::
cli_arg
>
xs
,
message
::
help_factory
f
=
nullptr
)
const
{
return
to_message
().
extract_opts
(
std
::
move
(
xs
),
std
::
move
(
f
));
message
::
help_factory
f
=
nullptr
,
bool
no_help
=
false
)
const
{
return
to_message
().
extract_opts
(
std
::
move
(
xs
),
std
::
move
(
f
)
,
no_help
);
}
/// @copydoc message::apply
...
...
libcaf_core/src/message.cpp
View file @
6de24d09
...
...
@@ -175,7 +175,7 @@ message message::extract(message_handler handler) const {
}
message
::
cli_res
message
::
extract_opts
(
std
::
vector
<
cli_arg
>
xs
,
help_factory
f
)
const
{
help_factory
f
,
bool
no_help
)
const
{
std
::
string
helpstr
;
auto
make_error
=
[
&
](
std
::
string
err
)
->
cli_res
{
return
{
*
this
,
std
::
set
<
std
::
string
>
{},
std
::
move
(
helpstr
),
std
::
move
(
err
)};
...
...
@@ -192,7 +192,7 @@ message::cli_res message::extract_opts(std::vector<cli_arg> xs,
return
s
[
0
]
==
"help"
||
std
::
find_if
(
s
.
begin
()
+
1
,
s
.
end
(),
has_short_help
)
!=
s
.
end
();
};
if
(
std
::
none_of
(
xs
.
begin
(),
xs
.
end
(),
pred
))
{
if
(
!
no_help
&&
std
::
none_of
(
xs
.
begin
(),
xs
.
end
(),
pred
))
{
xs
.
push_back
(
cli_arg
{
"help,h,?"
,
"print this text"
});
}
std
::
map
<
std
::
string
,
cli_arg
*>
shorts
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment