All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.iq80.cli.CommandSuggester Maven / Gradle / Ivy

package org.iq80.cli;

import com.google.common.collect.ImmutableList;
import org.iq80.cli.model.CommandMetadata;
import org.iq80.cli.model.OptionMetadata;

import javax.inject.Inject;

import static com.google.common.collect.Iterables.concat;
import static com.google.common.collect.Iterables.transform;

public class CommandSuggester
        implements Suggester
{
    @Inject
    public CommandMetadata command;

    @Override
    public Iterable suggest()
    {
        ImmutableList.Builder suggestions = ImmutableList.builder()
                .addAll(concat(transform(command.getCommandOptions(), OptionMetadata.optionsGetter())));

        if (command.getArguments() != null) {
            suggestions.add("--");
        }

        return suggestions.build();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy