|
TypeCommand |
|
1 // joi/6/juno/TypeCommand.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 the contents of a
10 * text file.
11 * Usage:
12 * <pre>
13 * type textfile
14 * </pre>
15 *
16 * @version 6
17 */
18
19 public class TypeCommand extends ShellCommand
20 {
21 /**
22 * Construct a TypeCommand object.
23 */
24
25 TypeCommand()
26 {
27 super( "display contents of a TextFile", "textfile" );
28 }
29
30 /**
31 * Display the contents of a TextFile.
32 *
33 * @param args the reminder of the command line.
34 * @param sh the current Shell
35 */
36
37 public void doIt( StringTokenizer args, Shell sh )
38 {
39 String filename = args.nextToken();
40 sh.getConsole().println(
41 ( (TextFile) sh.getDot().
42 retrieveJFile( filename ) ).getContents() );
43 }
44 }
45
|
TypeCommand |
|