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