Bugfix/cli 221 add Option.Builder.listValueSeparator()
Strictly speaking, the described behaviour in CLI-221 is not a bug as it is needed to fulfill the documented behaviour described in
https://issues.apache.org/jira/browse/CLI-325
around interpreting java property like arguments.
However, when you want to parse list values instead of java properties, the behaviour is bad as the user need to terminate a list argument with double dash --, which is counterintuitive. Also changing the option's order changes the behaviour.
The suggested solution in PR adds the new Option.Builder.listValueSeparator() methods, which must be used instead of Option.Builder.valueSeparator() to achieve the behaviour desired in this issues' description, see javadoc for usage.
It is only added in the DefaultParser() and not fixed for the other deprecated parser implementations.
The user can then use the option in any order, e.g.
- cmd1 -o1 blue,green,yellow -f otheroption a1
- cmd1 -f otheroption -o1 blue,green,yellow a1
- cmd1 a1 -f otheroption -o1 blue,green,yellow
!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
Thanks for your contribution to Apache Commons! Your help is appreciated!
Before you push a pull request, review this list:
- [x] Read the contribution guidelines for this project.
- [x] Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
- [ ] I used AI to create any part of, or all of, this pull request.
- [x] Run a successful build using the default Maven goal with
mvn; that'smvnon the command line by itself. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best-practice.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.