2 * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
7 package eu.svjatoslav.meviz;
9 import eu.svjatoslav.meviz.encoder.Encoder;
11 import java.util.ArrayList;
15 private static ArrayList<Module> modules;
17 private static String[] getRemainingOptions(final String[] options) {
18 final String[] remainingOptions = new String[options.length - 1];
20 System.arraycopy(options, 1, remainingOptions, 0, options.length - 1);
22 return remainingOptions;
25 private static void initModules() {
26 modules = new ArrayList<>();
28 modules.add(new Encoder());
29 modules.add(new eu.svjatoslav.meviz.htmlindexer.Main());
30 modules.add(new eu.svjatoslav.meviz.renamer.Main());
31 modules.add(new eu.svjatoslav.meviz.bomremove.Main());
32 modules.add(new eu.svjatoslav.meviz.replace.Main());
35 public static void main(final String[] args) throws Exception {
41 else if (args[0].equals("help")) {
46 for (final Module module : modules)
47 if (args[1].equals(module.getModuleCommand())) {
48 module.showCommandlineHelp();
52 System.out.println("Error: unrecognized module by name:"
59 for (final Module module : modules)
60 if (args[0].equals(module.getModuleCommand())) {
61 module.run(getRemainingOptions(args));
65 System.out.println("Error: unrecognized commandline option:"
72 private static void showHelp() {
73 final StringBuilder buffer = new StringBuilder();
75 buffer.append("Commandline options: \n"
76 + "help\n show this help screen \n\n");
78 buffer.append("help <module>\n show module specific help screen\n\n");
80 buffer.append("Available modules:\n\n");
82 for (final Module module : modules) {
83 buffer.append(module.getModuleCommand() + "\n");
84 buffer.append(" " + module.getDescription() + "\n\n");
87 System.out.println(buffer.toString());