static CliReceivedCommand consumeCommandLineInput ( ParseResult providedCommand , @ SuppressWarnings ( "SameParameterValue" ) Iterable < CliDeclaredOptionSpec > declaredOptions ) { assumeTrue ( providedCommand . hasSubcommand ( ) , "Command was empty, expected one of: " + Arrays . toString ( CliCommandType . values ( ) ) ) ; final ParseResult mailCommand = providedCommand . subcommand ( ) ; final CliCommandType matchedCommand = CliCommandType . valueOf ( mailCommand . commandSpec ( ) . name ( ) ) ; final Map < CliDeclaredOptionSpec , OptionSpec > matchedOptionsInOrderProvision = matchProvidedOptions ( declaredOptions , mailCommand . matchedOptions ( ) ) ; logParsedInput ( matchedCommand , matchedOptionsInOrderProvision ) ; List < CliReceivedOptionData > receivedOptions = new ArrayList <> ( ) ; for ( Entry < CliDeclaredOptionSpec , OptionSpec > cliOption : matchedOptionsInOrderProvision . entrySet ( ) ) { final Method sourceMethod = cliOption . getKey ( ) . getSourceMethod ( ) ; final int mandatoryParameters = MiscUtil . countMandatoryParameters ( sourceMethod ) ; final List < String > providedStringValues = cliOption . getValue ( ) . getValue ( ) ; assumeTrue ( providedStringValues . size ( ) >= mandatoryParameters , format ( "provided %s arguments, but need at least %s" , providedStringValues . size ( ) , mandatoryParameters ) ) ; assumeTrue ( providedStringValues . size ( ) <= sourceMethod . getParameterTypes ( ) . length , format ( "provided %s arguments, but need at most %s" , providedStringValues . size ( ) , sourceMethod . getParameterTypes ( ) . length ) ) ; receivedOptions . add ( new CliReceivedOptionData ( cliOption . getKey ( ) , convertProvidedOptionValues ( providedStringValues , sourceMethod ) ) ) ; LOGGER . debug ( "\tconverted option values: {}" , getLast ( receivedOptions ) . getProvidedOptionValues ( ) ) ; } return new CliReceivedCommand ( matchedCommand , receivedOptions ) ; }
we reach here when terminal input was value and no help was requested