Restore multiple socket support after clap upgrade #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another impact of the update to clap is that the support for multiple copies of a parameter has changed. This means that it is currently not possible to specify multiple listening sockets.
Clap has added a feature which allows a single parameter to take multiple values, for instance
-s 2000 3000
would create two listening TCP sockets. This behaviour is enabled with theArg::num_args
function when given a range.Related to this, the
Arg::number_of_values
function is now a call toArg::num_args
with a single value (and as a result is deprecated).The combination of these two factors means that the current code is first setting a range, and then overriding this with a unit value.
One option would therefore be to remove line 37 (
.number_of_values(1)
) although this would then need to update documentation and usages.To restore the previous behaviour it is necessary to add a call to
Arg::action
, specifying to append parameters into a list. The calls tonum_args
andnumber_of_values
can then be removed as the number defaults to a single value per option.