1   // joi/10/juno/NewfileCommand.java                         
2   //                                                            
3   //                                                            
4   // Copyright 2003, Bill Campbell and Ethan Bolker                         
5                                                               
6   import java.util.*;
7   
8   /**
9    * The Juno shell command to create a text file.
10   * Usage:
11   * <pre>
12   *     newfile filename contents
13   * </pre>
14   *
15   * @version 10
16   */
17  
18  public class NewfileCommand extends ShellCommand 
19  {
20      NewfileCommand() 
21      {
22          super( "create a new TextFile", "filename contents" );
23      }
24  
25      /**
26       * Create a new TextFile in the current Directory.
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          String filename;
38          String contents;
39          filename = args.nextToken();
40          contents  = args.nextToken("").trim(); // rest of line
41          new TextFile( filename, sh.getUser(),
42                        sh.getDot(), contents );
43      }
44  }
45