2 * Meviz - Various tools collection to work with multimedia.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.meviz;
12 import eu.svjatoslav.meviz.encoder.Encoder;
14 import java.util.ArrayList;
18 public static ArrayList<Module> modules;
20 public static String[] getRemainingOptions(final String[] options) {
21 final String[] remainingOptions = new String[options.length - 1];
23 System.arraycopy(options, 1, remainingOptions, 0, options.length - 1);
25 return remainingOptions;
28 public static void initModules() {
29 modules = new ArrayList<Module>();
31 modules.add(new Encoder());
32 modules.add(new eu.svjatoslav.meviz.htmlindexer.Main());
33 modules.add(new eu.svjatoslav.meviz.renamer.Main());
34 modules.add(new eu.svjatoslav.meviz.grabmemcard.Main());
35 modules.add(new eu.svjatoslav.meviz.texttruncate.Main());
36 modules.add(new eu.svjatoslav.meviz.textsplitter.Main());
37 modules.add(new eu.svjatoslav.meviz.bomremove.Main());
38 modules.add(new eu.svjatoslav.meviz.replace.Main());
41 public static void main(final String[] args) throws Exception {
47 else if (args[0].equals("help")) {
52 for (final Module module : modules)
53 if (args[1].equals(module.getModuleCommand())) {
54 module.showCommandlineHelp();
58 System.out.println("Error: unrecognized module by name:"
65 for (final Module module : modules)
66 if (args[0].equals(module.getModuleCommand())) {
67 module.run(getRemainingOptions(args));
71 System.out.println("Error: unrecognized commandline option:"
78 public static void showHelp() {
79 final StringBuilder buffer = new StringBuilder();
81 buffer.append("Commandline options: \n"
82 + "help\n show this help screen \n\n");
84 buffer.append("help <module>\n show module specific help screen\n\n");
86 buffer.append("Available modules:\n\n");
88 for (final Module module : modules) {
89 buffer.append(module.getModuleCommand() + "\n");
90 buffer.append(" " + module.getDescription() + "\n\n");
93 System.out.println(buffer.toString());