Java 类org.springframework.boot.cli.command.options.OptionHelp 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CommandCompleter.java   
public CommandCompleter(ConsoleReader consoleReader,
        ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
    this.console = consoleReader;
    List<String> names = new ArrayList<String>();
    for (Command command : commands) {
        this.commands.add(command);
        names.add(command.getName());
        List<String> options = new ArrayList<String>();
        for (OptionHelp optionHelp : command.getOptionsHelp()) {
            options.addAll(optionHelp.getOptions());
        }
        AggregateCompleter argumentCompleters = new AggregateCompleter(
                new StringsCompleter(options), new FileNameCompleter());
        ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
                argumentCompleters);
        argumentCompleter.setStrict(false);
        this.commandCompleters.put(command.getName(), argumentCompleter);
    }
    getStrings().addAll(names);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HelpCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    List<OptionHelp> help = new ArrayList<OptionHelp>();
    for (final Command command : this.commandRunner) {
        if (isHelpShown(command)) {
            help.add(new OptionHelp() {

                @Override
                public Set<String> getOptions() {
                    return Collections.singleton(command.getName());
                }

                @Override
                public String getUsageHelp() {
                    return command.getDescription();
                }

            });
        }
    }
    return help;
}
项目:spring-boot-concourse    文件:CommandCompleter.java   
public CommandCompleter(ConsoleReader consoleReader,
        ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
    this.console = consoleReader;
    List<String> names = new ArrayList<String>();
    for (Command command : commands) {
        this.commands.add(command);
        names.add(command.getName());
        List<String> options = new ArrayList<String>();
        for (OptionHelp optionHelp : command.getOptionsHelp()) {
            options.addAll(optionHelp.getOptions());
        }
        AggregateCompleter argumentCompleters = new AggregateCompleter(
                new StringsCompleter(options), new FileNameCompleter());
        ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
                argumentCompleters);
        argumentCompleter.setStrict(false);
        this.commandCompleters.put(command.getName(), argumentCompleter);
    }
    getStrings().addAll(names);
}
项目:spring-boot-concourse    文件:HelpCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    List<OptionHelp> help = new ArrayList<OptionHelp>();
    for (final Command command : this.commandRunner) {
        if (isHelpShown(command)) {
            help.add(new OptionHelp() {

                @Override
                public Set<String> getOptions() {
                    return Collections.singleton(command.getName());
                }

                @Override
                public String getUsageHelp() {
                    return command.getDescription();
                }

            });
        }
    }
    return help;
}
项目:contestparser    文件:CommandCompleter.java   
public CommandCompleter(ConsoleReader consoleReader,
        ArgumentDelimiter argumentDelimiter, Iterable<Command> commands) {
    this.console = consoleReader;
    List<String> names = new ArrayList<String>();
    for (Command command : commands) {
        this.commands.add(command);
        names.add(command.getName());
        List<String> options = new ArrayList<String>();
        for (OptionHelp optionHelp : command.getOptionsHelp()) {
            options.addAll(optionHelp.getOptions());
        }
        AggregateCompleter arguementCompleters = new AggregateCompleter(
                new StringsCompleter(options), new FileNameCompleter());
        ArgumentCompleter argumentCompleter = new ArgumentCompleter(argumentDelimiter,
                arguementCompleters);
        argumentCompleter.setStrict(false);
        this.commandCompleters.put(command.getName(), argumentCompleter);
    }
    getStrings().addAll(names);
}
项目:contestparser    文件:HelpCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    List<OptionHelp> help = new ArrayList<OptionHelp>();
    for (final Command command : this.commandRunner) {
        if (isHelpShown(command)) {
            help.add(new OptionHelp() {

                @Override
                public Set<String> getOptions() {
                    return Collections.singleton(command.getName());
                }

                @Override
                public String getUsageHelp() {
                    return command.getDescription();
                }

            });
        }
    }
    return help;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CommandCompleter.java   
OptionHelpLine(OptionHelp optionHelp) {
    StringBuilder options = new StringBuilder();
    for (String option : optionHelp.getOptions()) {
        options.append(options.length() == 0 ? "" : ", ");
        options.append(option);
    }
    this.options = options.toString();
    this.usage = optionHelp.getUsageHelp();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HintCommand.java   
private void showCommandOptionHints(String commandName,
        List<String> specifiedArguments, String starting) {
    Command command = this.commandRunner.findCommand(commandName);
    if (command != null) {
        for (OptionHelp help : command.getOptionsHelp()) {
            if (!alreadyUsed(help, specifiedArguments)) {
                for (String option : help.getOptions()) {
                    if (option.startsWith(starting)) {
                        Log.info(option + " " + help.getUsageHelp());
                    }
                }
            }
        }
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HintCommand.java   
private boolean alreadyUsed(OptionHelp help, List<String> specifiedArguments) {
    for (String argument : specifiedArguments) {
        if (help.getOptions().contains(argument)) {
            return true;
        }
    }
    return false;
}
项目:spring-boot-concourse    文件:CommandCompleter.java   
OptionHelpLine(OptionHelp optionHelp) {
    StringBuilder options = new StringBuilder();
    for (String option : optionHelp.getOptions()) {
        options.append(options.length() == 0 ? "" : ", ");
        options.append(option);
    }
    this.options = options.toString();
    this.usage = optionHelp.getUsageHelp();
}
项目:spring-boot-concourse    文件:HintCommand.java   
private void showCommandOptionHints(String commandName,
        List<String> specifiedArguments, String starting) {
    Command command = this.commandRunner.findCommand(commandName);
    if (command != null) {
        for (OptionHelp help : command.getOptionsHelp()) {
            if (!alreadyUsed(help, specifiedArguments)) {
                for (String option : help.getOptions()) {
                    if (option.startsWith(starting)) {
                        Log.info(option + " " + help.getUsageHelp());
                    }
                }
            }
        }
    }
}
项目:spring-boot-concourse    文件:HintCommand.java   
private boolean alreadyUsed(OptionHelp help, List<String> specifiedArguments) {
    for (String argument : specifiedArguments) {
        if (help.getOptions().contains(argument)) {
            return true;
        }
    }
    return false;
}
项目:contestparser    文件:CommandCompleter.java   
OptionHelpLine(OptionHelp optionHelp) {
    StringBuffer options = new StringBuffer();
    for (String option : optionHelp.getOptions()) {
        options.append(options.length() == 0 ? "" : ", ");
        options.append(option);
    }
    this.options = options.toString();
    this.usage = optionHelp.getUsageHelp();
}
项目:contestparser    文件:HintCommand.java   
private void showCommandOptionHints(String commandName,
        List<String> specifiedArguments, String starting) {
    Command command = this.commandRunner.findCommand(commandName);
    if (command != null) {
        for (OptionHelp help : command.getOptionsHelp()) {
            if (!alreadyUsed(help, specifiedArguments)) {
                for (String option : help.getOptions()) {
                    if (option.startsWith(starting)) {
                        Log.info(option + " " + help.getUsageHelp());
                    }
                }
            }
        }
    }
}
项目:contestparser    文件:HintCommand.java   
private boolean alreadyUsed(OptionHelp help, List<String> specifiedArguments) {
    for (String argument : specifiedArguments) {
        if (help.getOptions().contains(argument)) {
            return true;
        }
    }
    return false;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AbstractCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return Collections.emptyList();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:OptionParsingCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.handler.getOptionsHelp();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ForkProcessCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.command.getOptionsHelp();
}
项目:spring-boot-concourse    文件:AbstractCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return Collections.emptyList();
}
项目:spring-boot-concourse    文件:OptionParsingCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.handler.getOptionsHelp();
}
项目:spring-boot-concourse    文件:ForkProcessCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.command.getOptionsHelp();
}
项目:contestparser    文件:AbstractCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return Collections.emptyList();
}
项目:contestparser    文件:OptionParsingCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.handler.getOptionsHelp();
}
项目:contestparser    文件:ForkProcessCommand.java   
@Override
public Collection<OptionHelp> getOptionsHelp() {
    return this.command.getOptionsHelp();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:Command.java   
/**
 * Returns help for each supported option.
 * @return help for each of the command's options
 */
Collection<OptionHelp> getOptionsHelp();
项目:spring-boot-concourse    文件:Command.java   
/**
 * Returns help for each supported option.
 * @return help for each of the command's options
 */
Collection<OptionHelp> getOptionsHelp();
项目:contestparser    文件:Command.java   
/**
 * Returns help for each supported option.
 * @return help for each of the command's options
 */
Collection<OptionHelp> getOptionsHelp();