335b07353e592ce55a128bfed6181e056b5ba892
[meviz.git] / src / main / java / eu / svjatoslav / meviz / htmlindexer / Main.java
1 package eu.svjatoslav.meviz.htmlindexer;
2
3 import java.util.ArrayList;
4
5 import eu.svjatoslav.meviz.Module;
6
7 public class Main implements Module {
8
9         CommandlineHandler commandlineHandler = new CommandlineHandler();
10
11         IndexingOptions indexingOptions;
12
13         /** {@inheritDoc} */
14         @Override
15         public String getDescription() {
16                 return "Generate HTML listing of directories.";
17         }
18
19         /** {@inheritDoc} */
20         @Override
21         public String getModuleCommand() {
22                 return "index";
23         }
24
25         /** {@inheritDoc} */
26         @Override
27         public void run(final String[] args) throws Exception {
28
29                 indexingOptions = commandlineHandler.parseCommandlineArguments(args);
30
31                 if (indexingOptions == null) {
32                         showCommandlineHelp();
33                         return;
34                 }
35
36                 new FilesystemIndexer(indexingOptions.workingDirectory,
37                                 indexingOptions, new ArrayList<String>());
38
39         }
40
41         /** {@inheritDoc} */
42         @Override
43         public void showCommandlineHelp() {
44                 commandlineHandler.initParser().showHelp();
45         }
46
47         // public static void main(final String[] args) throws Exception {
48         //
49         // final Main main = new Main();
50         // main.run(new String[] { "-w", "/home/n0/Desktop/testGallery/" });
51         //
52         // }
53
54 }