Search in sources :

Example 6 with Command

use of org.apache.nifi.toolkit.cli.api.Command in project nifi by apache.

the class CLIMain method runSingleCommand.

/**
 * Handles running a single command and exiting, non-interactive mode.
 *
 * @param args the args passed in from the command line
 */
private static int runSingleCommand(final String[] args) {
    final Context context = createContext(System.out, false);
    final Map<String, Command> topLevelCommands = CommandFactory.createTopLevelCommands(context);
    final Map<String, CommandGroup> commandGroups = CommandFactory.createCommandGroups(context);
    final CommandProcessor commandProcessor = new CommandProcessor(topLevelCommands, commandGroups, context);
    return commandProcessor.process(args);
}
Also used : StandardContext(org.apache.nifi.toolkit.cli.impl.context.StandardContext) Context(org.apache.nifi.toolkit.cli.api.Context) Command(org.apache.nifi.toolkit.cli.api.Command) CommandGroup(org.apache.nifi.toolkit.cli.api.CommandGroup) CommandProcessor(org.apache.nifi.toolkit.cli.impl.command.CommandProcessor)

Aggregations

Command (org.apache.nifi.toolkit.cli.api.Command)6 CommandGroup (org.apache.nifi.toolkit.cli.api.CommandGroup)5 Context (org.apache.nifi.toolkit.cli.api.Context)4 StandardContext (org.apache.nifi.toolkit.cli.impl.context.StandardContext)4 CommandProcessor (org.apache.nifi.toolkit.cli.impl.command.CommandProcessor)3 NiFiRegistryClient (org.apache.nifi.registry.client.NiFiRegistryClient)2 Session (org.apache.nifi.toolkit.cli.api.Session)2 NiFiClientFactory (org.apache.nifi.toolkit.cli.impl.client.NiFiClientFactory)2 NiFiRegistryClientFactory (org.apache.nifi.toolkit.cli.impl.client.NiFiRegistryClientFactory)2 NiFiClient (org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient)2 InMemorySession (org.apache.nifi.toolkit.cli.impl.session.InMemorySession)2 LineReader (org.jline.reader.LineReader)2 PrintStream (java.io.PrintStream)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1 ParseException (org.apache.commons.cli.ParseException)1 CommandException (org.apache.nifi.toolkit.cli.api.CommandException)1 Exit (org.apache.nifi.toolkit.cli.impl.command.misc.Exit)1 Help (org.apache.nifi.toolkit.cli.impl.command.misc.Help)1 NiFiRegistryCommandGroup (org.apache.nifi.toolkit.cli.impl.command.registry.NiFiRegistryCommandGroup)1