-
Notifications
You must be signed in to change notification settings - Fork 441
Closed
Labels
Milestone
Description
final AgentConfig config = new AgentConfig();
final CommandLine commandLine = new CommandLine(config);
commandLine.setTrimQuotes(true);
commandLine.setSplitQuotedStrings(true);
commandLine.setCaseInsensitiveEnumValuesAllowed(true);
try
{
commandLine.parse(args);
}
catch (CommandLine.ParameterException e)
{
System.err.println(e.getMessage());
commandLine.usage(System.err);
return;
}
[picocli DEBUG] Creating CommandSpec for object of class com.package.AgentConfig with factory picocli.CommandLine$DefaultFactory
[picocli INFO] Picocli version: 4.0.0-beta-1b, JVM: 1.8.0_202 (Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.202-b08), OS: Linux 4.15.0-51-generic amd64
[picocli INFO] Parsing 8 command line args ["--env", "ACCEPTANCE_MULTIBOX", "--command", "DEPLOY", "--release-revision", "0.28.0-ci", "--servers", "10.24.2.24-LARGE,10.24.2.183-LARGE,10.24.2.13-LARGE,10.24.2.166-LARGE,10.24.2.53-LARGE,10.24.2.100-LARGE"]
[picocli DEBUG] Parser configuration: posixClusteredShortOptionsAllowed=true, stopAtPositional=false, stopAtUnmatched=false, separator=null, overwrittenOptionsAllowed=false, unmatchedArgumentsAllowed=false, expandAtFiles=true, atFileCommentChar=#, useSimplifiedAtFiles=false, endOfOptionsDelimiter=--, limitSplit=false, aritySatisfiedByAttachedOptionParam=false, toggleBooleanFlags=false, unmatchedOptionsArePositionalParams=false, collectErrors=false,caseInsensitiveEnumValuesAllowed=true, trimQuotes=true, splitQuotedStrings=true
[picocli DEBUG] (ANSI is disabled by default: isatty=false, XTERM=null, OSTYPE=null, isWindows=false, JansiConsoleInstalled=false, ANSICON=null, ConEmuANSI=null, NO_COLOR=null, CLICOLOR=null, CLICOLOR_FORCE=null)
[picocli DEBUG] Set initial value for field com.package.environment.Environment com.package.AgentConfig.environment of type class com.package.environment.Environment to null.
[picocli DEBUG] Set initial value for field com.package.command.Command com.package.AgentConfig.command of type class com.package.command.Command to null.
[picocli DEBUG] Set initial value for field String com.package.AgentConfig.releaseRevision of type class java.lang.String to SNAPSHOT.
[picocli DEBUG] Set initial value for field String com.package.AgentConfig.backupId of type class java.lang.String to null.
[picocli DEBUG] Set initial value for field java.util.List<String> com.package.AgentConfig.serviceNames of type interface java.util.List to [].
[picocli DEBUG] Set initial value for field java.util.List<String> com.package.AgentConfig.hosts of type interface java.util.List to [].
[picocli DEBUG] Set initial value for field boolean com.package.AgentConfig.force of type boolean to false.
[picocli DEBUG] Set initial value for field java.util.List<com.package.environment.HostInfo> com.package.AgentConfig.serversForDynamicTopologies of type interface java.util.List to [].
[picocli DEBUG] Set initial value for field java.util.List<java.util.Map$Entry<String, String>> com.package.AgentConfig.configProperties of type interface java.util.List to [].
[picocli DEBUG] Initializing com.package.AgentConfig: 9 options, 0 positional parameters, 2 required, 0 groups, 0 subcommands.
[picocli DEBUG] Processing argument '"--env"'. Remainder=["ACCEPTANCE_MULTIBOX", "--command", "DEPLOY", "--release-revision", "0.28.0-ci", "--servers", "10.24.2.24-LARGE,10.24.2.183-LARGE,10.24.2.13-LARGE,10.24.2.166-LARGE,10.24.2.53-LARGE,10.24.2.100-LARGE"]
[picocli DEBUG] '"--env"' cannot be separated into <option>=<option-parameter>
[picocli DEBUG] Could not find option '"--env"', deciding whether to treat as unmatched option or positional parameter...
...
```java
@CommandLine.Option(names = {"--env", "-e"}, description = "Environment to execute on", required = true)
private Environment environment;
@CommandLine.Option(names = {"--command", "-c"}, description = "Command to execute", required = true)
private Command command;
...