private void parseOptionArgument(String arg) throws CommandLineParsingException {
        final String PROMPT_FOR_VALUE = "PROMPT";

        if(arg.toLowerCase().startsWith("--" + OPTIONS.VERBOSE))
            return;

        String[] splitArg = splitArg(arg);

        String attributeName = splitArg[0];
        String value = splitArg[1];

        if (PROMPT_FOR_VALUE.equalsIgnoreCase(StringUtil.trimToEmpty(value))) {
            Console c = System.console();
            if (c == null) {
                throw new CommandLineParsingException(
                        String.format(MessageFormat.format(coreBundle.getString(
                                "cannot.prompt.for.the.value.no.console"), attributeName))
                );
            }
            //Prompt for value
            if (attributeName.toLowerCase().contains("password")) {
                value = new String(c.readPassword(attributeName + ": "));
            } else {
                value = c.readLine(attributeName + ": ");
            }
        }

        try {
            Field field = getClass().getDeclaredField(attributeName);
            if (field.getType().equals(Boolean.class)) {
                field.set(this, Boolean.valueOf(value));
            } else {
                field.set(this, value);
            }
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new CommandLineParsingException(
                    String.format(coreBundle.getString("option.unknown"), attributeName)
            );
        }
    }
private void parseOptionArgument(String arg) throws CommandLineParsingException {
        final String PROMPT_FOR_VALUE = "PROMPT";

        if(arg.toLowerCase().startsWith("--" + OPTIONS.VERBOSE))
            return;

        String[] splitArg = splitArg(arg);

        String attributeName = splitArg[0];
        String value = splitArg[1];

        if (PROMPT_FOR_VALUE.equalsIgnoreCase(StringUtil.trimToEmpty(value))) {
            Console c = System.console();
            if (c == null) {
                throw new CommandLineParsingException(
                        String.format(MessageFormat.format(coreBundle.getString(
                                "cannot.prompt.for.the.value.no.console"), attributeName))
                );
            }
            
            if (attributeName.toLowerCase().contains("password")) {
                value = new String(c.readPassword(attributeName + ": "));
            } else {
                value = c.readLine(attributeName + ": ");
            }
        }

        try {
            Field field = getClass().getDeclaredField(attributeName);
            if (field.getType().equals(Boolean.class)) {
                field.set(this, Boolean.valueOf(value));
            } else {
                field.set(this, value);
            }
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new CommandLineParsingException(
                    String.format(coreBundle.getString("option.unknown"), attributeName)
            );
        }
    }
private void parseOptionArgument ( String arg ) throws CommandLineParsingException { final String PROMPT_FOR_VALUE = "PROMPT" ; if ( arg . toLowerCase ( ) . startsWith ( "--" + OPTIONS . VERBOSE ) ) return ; String [ ] splitArg = splitArg ( arg ) ; String attributeName = splitArg [ 0 ] ; String value = splitArg [ 1 ] ; if ( PROMPT_FOR_VALUE . equalsIgnoreCase ( StringUtil . trimToEmpty ( value ) ) ) { Console c = System . console ( ) ; if ( c == null ) { throw new CommandLineParsingException ( String . format ( MessageFormat . format ( coreBundle . getString ( "cannot.prompt.for.the.value.no.console" ) , attributeName ) ) ) ; } //Prompt for value if ( attributeName . toLowerCase ( ) . contains ( "password" ) ) { value = new String ( c . readPassword ( attributeName + ": " ) ) ; } else { value = c . readLine ( attributeName + ": " ) ; } } try { Field field = getClass ( ) . getDeclaredField ( attributeName ) ; if ( field . getType ( ) . equals ( Boolean . class ) ) { field . set ( this , Boolean . valueOf ( value ) ) ; } else { field . set ( this , value ) ; } } catch ( IllegalAccessException | NoSuchFieldException e ) { throw new CommandLineParsingException ( String . format ( coreBundle . getString ( "option.unknown" ) , attributeName ) ) ; } }
Parses an option ("--someOption") from the command line

@param arg the option to parse (including the "--")
@throws CommandLineParsingException if a problem occurs
Parses an option ( -- someOption ) from the command line