1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.millscript.apps.website;
22
23 import com.townleyenterprises.command.CommandOption;
24 import com.townleyenterprises.command.CommandParser;
25 import com.townleyenterprises.command.DefaultCommandListener;
26
27 /**
28 *
29 *
30 */
31 public class Website {
32
33 private CommandOption _average_load = new AverageLoadCommandOption();
34
35 private CommandOption _find = new FindCommandOption();
36
37 private CommandOption _new = new NewCommandOption();
38
39 private CommandParser _parser = new CommandParser( "website" );
40
41 private CommandOption _purge = new PurgeCommandOption();
42
43 private CommandOption _quiet = new QuietCommandOption();
44
45 private CommandOption _status = new StatusCommandOption();
46
47 private CommandOption _unattended = new UnattendedCommandOption();
48
49 private CommandOption _who = new WhoCommandOption();
50
51 private CommandOption[] _options = {
52 _quiet, _unattended
53 };
54
55 private CommandOption[] _commands = {
56 _average_load, _find, _new, _purge, _status, _who
57 };
58
59 public Website( String[] args ) {
60 _parser.setExitOnMissingArg( true, -100 );
61 _parser.setExtraHelpText(
62 "The admin tool for a MillScript website",
63 "See the MillScript website for further details: http://www.millscript.org/"
64 );
65 _parser.addCommandListener(
66 new DefaultCommandListener(
67 "website options",
68 _options
69 )
70 );
71 _parser.addCommandListener(
72 new DefaultCommandListener(
73 "website commands",
74 _commands
75 )
76 );
77 _parser.parse( args );
78 try {
79 _parser.executeCommands();
80 } catch ( Exception ex ) {
81 ex.printStackTrace();
82 System.exit( -111 );
83 }
84 }
85
86 public static void main( String[] args ) {
87 Website website = new Website( args );
88 }
89 }