|
HelpCommand |
|
1 // joi/10/juno/HelpCommand.java
2 //
3 //
4 // Copyright 2003, Bill Campbell and Ethan Bolker
5
6 import java.util.*;
7
8 /**
9 * The Juno shell command to display help on the shell commands.
10 * Usage:
11 * <pre>
12 * help
13 * </pre>
14 *
15 * @version 10
16 */
17
18 public class HelpCommand extends ShellCommand
19 {
20 HelpCommand()
21 {
22 super( "display ShellCommands" );
23 }
24
25 /**
26 * Print out help for all commands.
27 *
28 * @param args the remainder of the command line.
29 * @param sh the current shell
30 *
31 * @exception JunoException for reporting errors
32 */
33
34 public void doIt( StringTokenizer args, Shell sh )
35 throws JunoException
36 {
37 // Get command keys from global table, print them out.
38
39 sh.getConsole().println( "shell commands" );
40 ShellCommandTable table = sh.getSystem().getCommandTable();
41 String[] names = table.getCommandNames();
42 for (int i = 0; i < names.length; i++ ) {
43 String cmdname = names[i];
44 ShellCommand cmd =
45 (ShellCommand) table.lookup( cmdname );
46 sh.getConsole().
47 println( " " + cmdname + ": " + cmd.getHelpString() );
48 }
49 }
50 }
51
|
HelpCommand |
|