@Test public void helpListing() throws CommandException { List<Command> commandList = new ArrayList<>(); commandList.add(new FakeCommand("bob")); commandList.add(new FakeCommand("bobby")); doReturn(commandList).when(cmdHelper).getAllCommands(); cmd.execute(""); verify(logger).printOut("\nAvailable commands:"); verify(logger).printOut(" @|BOLD bob |@ description for bob"); verify(logger).printOut(" @|BOLD bobby|@ description for bobby"); verify(logger).printOut("\nFor help on a specific command type:"); verify(logger).printOut(" :help@|BOLD command|@\n"); verify(logger).printOut("\nFor help on cypher please visit:"); verify(logger).printOut(" " + Help.CYPHER_REFCARD_LINK + "\n"); }
@Override public void execute(@Nonnull final String argString) throws CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length == 0) { printGeneralHelp(); } else { printHelpFor(args[0]); } }
Help implements Command { @Override public void execute(@Nonnull final String argString) throws CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length == 0) { printGeneralHelp(); } else { printHelpFor(args[0]); } } }
Help implements Command { @Override public void execute(@Nonnull final String argString) throws CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length == 0) { printGeneralHelp(); } else { printHelpFor(args[0]); } } Help(@Nonnull final Logger shell, @Nonnull final CommandHelper commandHelper); }
Help implements Command { @Override public void execute(@Nonnull final String argString) throws CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length == 0) { printGeneralHelp(); } else { printHelpFor(args[0]); } } Help(@Nonnull final Logger shell, @Nonnull final CommandHelper commandHelper); @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); }
Help implements Command { @Override public void execute(@Nonnull final String argString) throws CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); if (args.length == 0) { printGeneralHelp(); } else { printHelpFor(args[0]); } } Help(@Nonnull final Logger shell, @Nonnull final CommandHelper commandHelper); @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; static String CYPHER_REFCARD_LINK; }