Start making vtest command arguments less positional #4
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.
NB: This patch does not work with vtest as-is because of other missing patches. Before running into more of a chicken/egg double maintenance situation, I would prefer to achieve consensus about https://github.com/nigoroll/vtest2/ (see also varnishcache/varnish-cache#4333). This patch currently is in vtest2 WIP as nigoroll@a907e42, but I am not sold on it.
This ticket is to ask about feedback.
Our common pattern of argument parsing is basically
This makes vtest command arguments "semi-positional": Within each set, they behave like named arguments usually do, but once parsing progressed to the next set, they behave like positional arguments. This is explicitly mentioned in the documentation, for example for txreq/txresp:
While properly documented, this is un-POLA behavior.
This patch changes this behavior for the first set of txreq/txresp arguments in a simplistic way by filtering known arguments out of the argument vector. The drawback of the simplistic approach is that argument values of a "later stage" can not be the same string as argument names of an "earlier stage". For example, the following would no longer work:
Do we want this compromise? If not, I would prefer to just stick to "RTFM".
In Response to #1