Search in sources :

Example 1 with CommandLineArgument

use of com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument in project intellij-community by JetBrains.

the class CommandLinePsiImplUtils method findBestHelp.

/**
   * Tries to find appropriate help for argument. It can be argument help for positional argument or option help
   * for option argument.
   *
   * @param argument argument to search help for
   * @return help for argument or null if not found
   */
@Nullable
static Help findBestHelp(@NotNull final CommandLineArgument argument) {
    final Option option = argument.findOptionForOptionArgument();
    if (option != null) {
        return option.getHelp();
    }
    final Argument realArgument = argument.findRealArgument();
    return (realArgument != null ? realArgument.getHelp() : null);
}
Also used : CommandLineArgument(com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument) Argument(com.jetbrains.commandInterface.command.Argument) CommandLineOption(com.jetbrains.commandInterface.commandLine.psi.CommandLineOption) Option(com.jetbrains.commandInterface.command.Option) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Argument (com.jetbrains.commandInterface.command.Argument)1 Option (com.jetbrains.commandInterface.command.Option)1 CommandLineArgument (com.jetbrains.commandInterface.commandLine.psi.CommandLineArgument)1 CommandLineOption (com.jetbrains.commandInterface.commandLine.psi.CommandLineOption)1 Nullable (org.jetbrains.annotations.Nullable)1