use of org.neo4j.shell.commands.Command in project neo4j by neo4j.
the class CommandHelperTest method shouldIgnoreCaseForCommands.
@Test
public void shouldIgnoreCaseForCommands() {
// Given
AnsiLogger logger = new AnsiLogger(false);
CommandHelper commandHelper = new CommandHelper(logger, Historian.empty, new CypherShell(logger, PrettyConfig.DEFAULT, false, new ShellParameterMap()));
// When
Command begin = commandHelper.getCommand(":BEGIN");
// Then
assertTrue(begin instanceof Begin);
}
use of org.neo4j.shell.commands.Command in project neo4j by neo4j.
the class CypherShell method getCommandExecutable.
@Nonnull
protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) {
Matcher m = cmdNamePattern.matcher(line);
if (commandHelper == null || !m.matches()) {
return Optional.empty();
}
String name = m.group("name");
String args = m.group("args");
Command cmd = commandHelper.getCommand(name);
if (cmd == null) {
return Optional.empty();
}
return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args)));
}
Aggregations