use of com.bluenimble.platform.cli.command.impls.AbstractCommand in project serverless by bluenimble.
the class EndLnParser method main.
public static void main(String[] args) throws CommandParsingError {
String cmdLine = " -s -f argF -a rg2 -q select * \n from \n where 1=1";
AbstractCommand command = new AbstractCommand("abc", "desc", "s,f++,!q+") {
private static final long serialVersionUID = 0L;
@Override
public CommandResult execute(Tool tool, Map<String, CommandOption> options) throws CommandExecutionException {
return null;
}
};
CommandParser wrapper = new CommandParserImpl();
Map<String, CommandOption> res = wrapper.parse(command, cmdLine);
Iterator<CommandOption> optionsIter = res.values().iterator();
while (optionsIter.hasNext()) {
System.out.print(optionsIter.next());
}
}
use of com.bluenimble.platform.cli.command.impls.AbstractCommand in project serverless by bluenimble.
the class NoOptionsParser method main.
public static void main(String[] args) throws CommandParsingError {
String cmdLine = " -s -f argF -a rg2 -mult arg1 -";
AbstractCommand command = new AbstractCommand("abc", "desc") {
private static final long serialVersionUID = 0L;
@Override
public CommandResult execute(Tool tool, Map<String, CommandOption> options) throws CommandExecutionException {
return null;
}
@Override
public Map<String, CommandOption> getOptions() {
return null;
}
};
CommandParser wrapper = new CommandParserImpl();
Map<String, CommandOption> res = wrapper.parse(command, cmdLine);
if (res != null) {
Iterator<CommandOption> optionsIter = res.values().iterator();
while (optionsIter.hasNext()) {
System.out.print(optionsIter.next());
}
}
}
use of com.bluenimble.platform.cli.command.impls.AbstractCommand in project serverless by bluenimble.
the class SimpleParser method main.
public static void main(String[] args) throws CommandParsingError {
String cmdLine = "-k teta -p beta";
AbstractCommand command = new AbstractCommand("use", "desc", "k+,p+") {
private static final long serialVersionUID = 0L;
@Override
public CommandResult execute(Tool tool, Map<String, CommandOption> options) throws CommandExecutionException {
return null;
}
};
CommandParser parser = new CommandParserImpl();
Iterator<CommandOption> optionsIter = parser.parse(command, cmdLine).values().iterator();
while (optionsIter.hasNext()) {
System.out.println(optionsIter.next());
}
}
use of com.bluenimble.platform.cli.command.impls.AbstractCommand in project serverless by bluenimble.
the class TypedOptionParser method main.
public static void main(String[] args) throws CommandParsingError {
String cmdLine = " -s -f argF -a rg2 -multi arg1 -";
AbstractCommand command = new AbstractCommand("abc", "desc", "s,f+,!multi+") {
private static final long serialVersionUID = 0L;
@Override
public CommandResult execute(Tool tool, Map<String, CommandOption> options) throws CommandExecutionException {
return null;
}
};
command.getOptions().get("f").setCast(CommandOptionCast.Integer);
CommandParser parser = new CommandParserImpl();
Iterator<CommandOption> optionsIter = parser.parse(command, cmdLine).values().iterator();
while (optionsIter.hasNext()) {
System.out.println(optionsIter.next());
}
}
Aggregations