Package org.jboss.aesh.cl

Examples of org.jboss.aesh.cl.CommandLine.addOption()


            if(parseLine.startsWith("--")) {
                //make sure that we dont have any "active" options lying around
                if(active != null) {
                    if(active.getOptionType() == OptionType.LIST ||
                            active.getOptionType() == OptionType.GROUP) {
                        commandLine.addOption(active);
                        active = null;
                    }
                    else {
                        commandLine.setParserException(new OptionParserException("Option: "+active.getDisplayName()+" must be given a value"));
                        break;
View Full Code Here


                        String value = parseLine.substring( parseLine.indexOf(EQUALS)+1);
                        if(value.length() < 1)
                            commandLine.setParserException(new OptionParserException("Option "+active.getDisplayName()+", must have a value"));
                        else {
                            active.addProperty(name, value);
                            commandLine.addOption(active);
                            active = null;
                            if(addedArgument)
                                commandLine.setParserException(new ArgumentParserException("An argument was given to an option that do not support it."));
                        }
                    }
View Full Code Here

                        }
                    }
                }
                else if(active != null && (!active.hasValue() || active.getValue() != null)) {
                    active.addValue("true");
                    commandLine.addOption(active);
                    active = null;
                    if(addedArgument)
                        commandLine.setParserException(new ArgumentParserException("An argument was given to an option that do not support it."));
                }
                else if(active == null)
View Full Code Here

                //make sure that we dont have any "active" options lying around
                //except list and group
                if(active != null) {
                    if(active.getOptionType() == OptionType.LIST ||
                            active.getOptionType() == OptionType.GROUP) {
                        commandLine.addOption(active);
                        active = null;
                    }
                    else {
                        commandLine.setParserException(new OptionParserException("Option: "+active.getDisplayName()+" must be given a value"));
                        break;
View Full Code Here

                            active = findOption(command, String.valueOf(shortName));
                            if(active != null) {
                                if(!active.hasValue()) {
                                    active.setLongNameUsed(false);
                                    active.addValue("true");
                                    commandLine.addOption(active);
                                }
                                else
                                    commandLine.setParserException( new OptionParserException("Option: -"+shortName+
                                            " can not be grouped with other options since it need to be given a value"));
                            }
View Full Code Here

                            String value = parseLine.substring( parseLine.indexOf(EQUALS)+1);
                            if(value.length() < 1)
                                commandLine.setParserException( new OptionParserException("Option "+active.getDisplayName()+", must have a value"));
                            else {
                                active.addProperty(name, value);
                                commandLine.addOption(active);
                                active = null;
                                if(addedArgument)
                                    commandLine.setParserException( new OptionParserException("An argument was given to an option that do not support it."));
                            }
                        }
View Full Code Here

                        }
                    }

                    else if(active != null && (!active.hasValue() || active.getValue() != null)) {
                        active.addValue("true");
                        commandLine.addOption(active);
                        active = null;
                        if(addedArgument)
                            commandLine.setParserException(new OptionParserException("An argument was given to an option that do not support it."));
                    }
                    else if(active == null)
View Full Code Here

                        for(String value : parseLine.split(String.valueOf(active.getValueSeparator()))) {
                            active.addValue(value.trim());
                        }
                        if(parseLine.endsWith(String.valueOf(active.getValueSeparator())))
                            active.setEndsWithSeparator(true);
                        commandLine.addOption(active);
                        active = null;
                    }
                    else
                        active.addValue(parseLine);
                }
View Full Code Here

                    active.addValue(parseLine);

                if(active != null &&
                        (active.getOptionType() == OptionType.NORMAL ||
                                active.getOptionType() == OptionType.BOOLEAN)) {
                    commandLine.addOption(active);
                    active = null;
                }
                if(addedArgument)
                    commandLine.setParserException(new OptionParserException("An argument was given to an option that do not support it."));
            }
View Full Code Here

            }
        }

        if(active != null && (ignoreRequirements ||
                (active.getOptionType() == OptionType.LIST || active.getOptionType() == OptionType.GROUP))) {
            commandLine.addOption(active);
        }

        //this will throw and CommandLineParserException if needed
        if(!ignoreRequirements) {
            RequiredOptionException re = checkForMissingRequiredOptions(command, commandLine);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.