source: trunk/java-utils/src/main/java/de/ugoe/cs/util/console/defaultcommands/CMDlistCommands.java @ 664

Last change on this file since 664 was 664, checked in by sherbold, 12 years ago
  • modified Command.help(): the help now returns a string with its usage instead of writing directly to the console
  • modified listCommands: now writes the help string of each command instead of just the name; this way, the parameters are displayed directly
  • moved listCommands from quest-ui-core to java-utils
File size: 990 bytes
Line 
1
2package de.ugoe.cs.util.console.defaultcommands;
3
4import java.util.List;
5
6import de.ugoe.cs.util.console.Command;
7import de.ugoe.cs.util.console.CommandExecuter;
8import de.ugoe.cs.util.console.Console;
9
10/**
11 * <p>
12 * Command to list all events (symbols) known to a usage profile (stochastic process).
13 * </p>
14 *
15 * @author Steffen Herbold
16 * @version 1.0
17 */
18public class CMDlistCommands implements Command {
19
20    /*
21     * (non-Javadoc)
22     *
23     * @see de.ugoe.cs.util.console.Command#run(java.util.List)
24     */
25    @Override
26    public void run(List<Object> parameters) {
27        Command[] commands = CommandExecuter.getInstance().getAvailableCommands();
28
29        for (Command command : commands) {
30            Console.println(command.help());
31        }
32    }
33
34    /*
35     * (non-Javadoc)
36     *
37     * @see de.ugoe.cs.util.console.Command#help()
38     */
39    @Override
40    public String help() {
41        return "listCommands";
42    }
43
44}
Note: See TracBrowser for help on using the repository browser.