|
HelpCommand |
|
1 // joi/6/juno/HelpCommand.java 2 // 3 // 4 // Copyright 2003, Ethan Bolker and Bill Campbell 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 6 16 */ 17 18 public class HelpCommand extends ShellCommand 19 { 20 /** 21 * Construct a HelpCommand object. 22 */ 23 24 HelpCommand() 25 { 26 super( "display ShellCommands" ); 27 } 28 29 /** 30 * Display help for all commands. 31 * 32 * @param args the remainder of the command line. 33 * @param sh the current shell 34 */ 35 36 public void doIt( StringTokenizer args, Shell sh ) 37 { 38 // Get command keys from global table, print them out, 39 // followed by command's help string. 40 41 sh.getConsole().println( "shell commands" ); 42 ShellCommandTable table = sh.getSystem().getCommandTable(); 43 String[] names = table.getCommandNames(); 44 for (int i = 0; i < names.length; i++ ) { 45 String cmdname = names[i]; 46 ShellCommand cmd = table.lookup( cmdname ); 47 sh.getConsole(). 48 println( " " + cmdname + ": " + cmd.getHelpString() ); 49 } 50 } 51 } 52
|
HelpCommand |
|