
org.jsimpledb.cli.CommandParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-cli Show documentation
Show all versions of jsimpledb-cli Show documentation
JSimpleDB classes supporting command line interfaces.
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.cli;
import org.jsimpledb.parse.ParseSession;
import org.jsimpledb.parse.Parser;
import org.jsimpledb.parse.WordParser;
import org.jsimpledb.util.ParseContext;
public class CommandParser implements Parser {
/**
* Parse a command and return the corresponding {@link CliSession.Action}.
*/
@Override
public CliSession.Action parse(ParseSession parseSession, ParseContext ctx, boolean complete) {
final CliSession session = (CliSession)parseSession;
final String commandName = new WordParser(session.getCommands().keySet(), "command").parse(session, ctx, complete);
return session.getCommands().get(commandName).parse(session, ctx, complete);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy