@Test public void runCommandWithArg() throws CommandException { vars.put("var", new ParamValue(String.valueOf(9), 9)); vars.put("param", new ParamValue(String.valueOf(9999), 9999)); cmd.execute("var"); verify(logger).printOut(":param var => 9"); verifyNoMoreInteractions(logger); }
@Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String trim = argString.trim(); Matcher matcher = backtickPattern.matcher(trim); if (trim.startsWith("`") && matcher.matches()) { listParam(trim); } else { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length > 0) { listParam(args[0]); } else { listAllParams(); } } }
Params implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String trim = argString.trim(); Matcher matcher = backtickPattern.matcher(trim); if (trim.startsWith("`") && matcher.matches()) { listParam(trim); } else { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length > 0) { listParam(args[0]); } else { listAllParams(); } } } }
Params implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String trim = argString.trim(); Matcher matcher = backtickPattern.matcher(trim); if (trim.startsWith("`") && matcher.matches()) { listParam(trim); } else { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length > 0) { listParam(args[0]); } else { listAllParams(); } } } Params(@Nonnull Logger logger, @Nonnull ParameterMap parameterMap); }
Params implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String trim = argString.trim(); Matcher matcher = backtickPattern.matcher(trim); if (trim.startsWith("`") && matcher.matches()) { listParam(trim); } else { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length > 0) { listParam(args[0]); } else { listAllParams(); } } } Params(@Nonnull Logger logger, @Nonnull ParameterMap parameterMap); @Nonnull @Override String getName(); @Nonnull @Override String getDescription(); @Nonnull @Override String getUsage(); @Nonnull @Override String getHelp(); @Nonnull @Override List<String> getAliases(); @Override void execute(@Nonnull final String argString); }
Params implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String trim = argString.trim(); Matcher matcher = backtickPattern.matcher(trim); if (trim.startsWith("`") && matcher.matches()) { listParam(trim); } else { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length > 0) { listParam(args[0]); } else { listAllParams(); } } } Params(@Nonnull Logger logger, @Nonnull ParameterMap parameterMap); @Nonnull @Override String getName(); @Nonnull @Override String getDescription(); @Nonnull @Override String getUsage(); @Nonnull @Override String getHelp(); @Nonnull @Override List<String> getAliases(); @Override void execute(@Nonnull final String argString); static final String COMMAND_NAME; }