Search in sources :

Example 1 with AeshCommandRuntimeBuilder

use of org.aesh.command.AeshCommandRuntimeBuilder in project infinispan by infinispan.

the class CLI method batch.

private CommandResult batch(String inputFile, Shell shell) {
    CommandRegistry commandRegistry = initializeCommands(Batch.class);
    AeshCommandRuntimeBuilder runtimeBuilder = AeshCommandRuntimeBuilder.builder();
    runtimeBuilder.commandActivatorProvider(new ContextAwareCommandActivatorProvider(context)).commandInvocationProvider(new ContextAwareCommandInvocationProvider(context)).commandNotFoundHandler(new CliCommandNotFoundHandler()).completerInvocationProvider(new ContextAwareCompleterInvocationProvider(context)).aeshContext(context).commandRegistry(commandRegistry);
    runtimeBuilder.shell(shell);
    CliRuntimeRunner cliRunner = new CliRuntimeRunner("batch", runtimeBuilder.build());
    int exitCode = cliRunner.args(new String[] { "run", inputFile }).execute();
    context.disconnect();
    return CommandResult.valueOf(exitCode);
}
Also used : CommandRegistry(org.aesh.command.registry.CommandRegistry) AeshCommandRuntimeBuilder(org.aesh.command.AeshCommandRuntimeBuilder) CliCommandNotFoundHandler(org.infinispan.cli.impl.CliCommandNotFoundHandler) ContextAwareCompleterInvocationProvider(org.infinispan.cli.completers.ContextAwareCompleterInvocationProvider) CliRuntimeRunner(org.infinispan.cli.impl.CliRuntimeRunner) ContextAwareCommandActivatorProvider(org.infinispan.cli.activators.ContextAwareCommandActivatorProvider) ContextAwareCommandInvocationProvider(org.infinispan.cli.impl.ContextAwareCommandInvocationProvider)

Example 2 with AeshCommandRuntimeBuilder

use of org.aesh.command.AeshCommandRuntimeBuilder in project infinispan by infinispan.

the class CLI method initialCommandRuntimeBuilder.

private static AeshCommandRuntimeBuilder initialCommandRuntimeBuilder(Shell shell, Properties properties, boolean kube) throws CommandRegistryException {
    AeshCommandRegistryBuilder registryBuilder = AeshCommandRegistryBuilder.builder();
    Context context;
    if (kube) {
        context = new KubernetesContext(properties);
        registryBuilder.command(Kube.class);
    } else {
        context = new ContextImpl(properties);
        registryBuilder.command(CLI.class);
    }
    AeshCommandRuntimeBuilder runtimeBuilder = AeshCommandRuntimeBuilder.builder();
    runtimeBuilder.commandActivatorProvider(new ContextAwareCommandActivatorProvider(context)).commandInvocationProvider(new ContextAwareCommandInvocationProvider(context)).commandNotFoundHandler(new CliCommandNotFoundHandler()).completerInvocationProvider(new ContextAwareCompleterInvocationProvider(context)).shell(shell).aeshContext(context).commandRegistry(registryBuilder.create());
    return runtimeBuilder;
}
Also used : KubernetesContext(org.infinispan.cli.impl.KubernetesContext) Context(org.infinispan.cli.Context) AeshCommandRegistryBuilder(org.aesh.command.impl.registry.AeshCommandRegistryBuilder) AeshCommandRuntimeBuilder(org.aesh.command.AeshCommandRuntimeBuilder) CliCommandNotFoundHandler(org.infinispan.cli.impl.CliCommandNotFoundHandler) ContextAwareCompleterInvocationProvider(org.infinispan.cli.completers.ContextAwareCompleterInvocationProvider) ContextImpl(org.infinispan.cli.impl.ContextImpl) ContextAwareCommandActivatorProvider(org.infinispan.cli.activators.ContextAwareCommandActivatorProvider) KubernetesContext(org.infinispan.cli.impl.KubernetesContext) ContextAwareCommandInvocationProvider(org.infinispan.cli.impl.ContextAwareCommandInvocationProvider)

Aggregations

AeshCommandRuntimeBuilder (org.aesh.command.AeshCommandRuntimeBuilder)2 ContextAwareCommandActivatorProvider (org.infinispan.cli.activators.ContextAwareCommandActivatorProvider)2 ContextAwareCompleterInvocationProvider (org.infinispan.cli.completers.ContextAwareCompleterInvocationProvider)2 CliCommandNotFoundHandler (org.infinispan.cli.impl.CliCommandNotFoundHandler)2 ContextAwareCommandInvocationProvider (org.infinispan.cli.impl.ContextAwareCommandInvocationProvider)2 AeshCommandRegistryBuilder (org.aesh.command.impl.registry.AeshCommandRegistryBuilder)1 CommandRegistry (org.aesh.command.registry.CommandRegistry)1 Context (org.infinispan.cli.Context)1 CliRuntimeRunner (org.infinispan.cli.impl.CliRuntimeRunner)1 ContextImpl (org.infinispan.cli.impl.ContextImpl)1 KubernetesContext (org.infinispan.cli.impl.KubernetesContext)1