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