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.htmlindexer;
14 import eu.svjatoslav.commons.commandline.parameterparser.Parser;
15 import eu.svjatoslav.commons.commandline.parameterparser.parameter.DirectoryParameter;
16 import eu.svjatoslav.commons.commandline.parameterparser.parameter.StringParameter;
17 import eu.svjatoslav.meviz.encoder.EncodingOptions;
19 public class CommandlineHandler {
21 Parser parser = new Parser();
23 StringParameter galleryNameParameter = parser.createStringParameter(
24 "Gallery title. (default is: " + Constants.DEFAULT_GALLERY_TITLE
25 + ").").addAliases("-t", "--gallery-title");
27 DirectoryParameter workingDirectoryParameter = parser
28 .createDirectoryParameter("Working directory.").addAliases("-w",
29 "--working-directory");
31 public String getGalleryTitle() {
32 if (galleryNameParameter.isParameterSpecified())
33 return galleryNameParameter.getValue();
34 return Constants.DEFAULT_GALLERY_TITLE;
37 public File getWorkingDirectory() {
38 if (workingDirectoryParameter.isParameterSpecified())
39 return workingDirectoryParameter.getValue();
41 return new File(System.getProperty("user.dir"));
45 * @return {@link EncodingOptions} if commandline arguments were
46 * successfully parsed, or <code>null</code> if parsing error
49 public boolean parseCommandlineArguments(final String[] args) {
50 return parser.parse(args);