Skip to content

Commit

Permalink
Added public IMainParameter interface to fix #559 (#583)
Browse files Browse the repository at this point in the history
Added public IMainParameter interface to fix #559
  • Loading branch information
JaumeRibas authored May 20, 2024
1 parent 2d3fc62 commit 0c89c10
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/main/java/com/beust/jcommander/IMainParameter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (C) 2024 the original author or authors.
* See the notice.md file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed 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
*
* http://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.
*/

package com.beust.jcommander;

public interface IMainParameter {

ParameterDescription getDescription();

}
5 changes: 3 additions & 2 deletions src/main/java/com/beust/jcommander/JCommander.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class JCommander {
* Description of a main parameter, which can be either a list of string or a single field. Both
* are subject to converters before being returned to the user.
*/
static class MainParameter {
static class MainParameter implements IMainParameter {
/**
* This field/method will contain whatever command line parameter is not an option.
*/
Expand Down Expand Up @@ -93,6 +93,7 @@ static class MainParameter {

private boolean firstTimeMainParameter = true;

@Override
public ParameterDescription getDescription() {
return description;
}
Expand Down Expand Up @@ -1144,7 +1145,7 @@ public Map<IKey, ParameterDescription> getDescriptions() {
return descriptions;
}

public MainParameter getMainParameter() {
public IMainParameter getMainParameter() {
return mainParameter;
}

Expand Down

0 comments on commit 0c89c10

Please sign in to comment.