move to java package: cli
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 16 Nov 2014 21:59:13 +0100
changeset 4f3b4caf1d05d
parent 3 e417b37e6c08
child 5 5019e3e93a4e
move to java package: cli
java/copy-image-resizer/nbproject/project.properties
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIOptions.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIParser.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIParserException.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIStarter.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIOptions.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIParser.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIParserException.java
java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIStarter.java
     1.1 --- a/java/copy-image-resizer/nbproject/project.properties	Sun Nov 16 21:57:03 2014 +0100
     1.2 +++ b/java/copy-image-resizer/nbproject/project.properties	Sun Nov 16 21:59:13 2014 +0100
     1.3 @@ -53,7 +53,7 @@
     1.4  javadoc.use=true
     1.5  javadoc.version=false
     1.6  javadoc.windowtitle=
     1.7 -main.class=cz.frantovo.copyImageResizer.CLIResizer
     1.8 +main.class=cz.frantovo.copyImageResizer.cli.CLIStarter
     1.9  manifest.file=manifest.mf
    1.10  meta.inf.dir=${src.dir}/META-INF
    1.11  mkdist.disabled=false
     2.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIOptions.java	Sun Nov 16 21:57:03 2014 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,91 +0,0 @@
     2.4 -/**
     2.5 - * copy-image-resizer
     2.6 - * Copyright © 2014 František Kučera (frantovo.cz)
     2.7 - *
     2.8 - * This program is free software: you can redistribute it and/or modify
     2.9 - * it under the terms of the GNU General Public License as published by
    2.10 - * the Free Software Foundation, either version 3 of the License, or
    2.11 - * (at your option) any later version.
    2.12 - *
    2.13 - * This program is distributed in the hope that it will be useful,
    2.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    2.16 - * GNU General Public License for more details.
    2.17 - *
    2.18 - * You should have received a copy of the GNU General Public License
    2.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
    2.20 - */
    2.21 -package cz.frantovo.copyImageResizer;
    2.22 -
    2.23 -import java.io.File;
    2.24 -import java.util.ArrayList;
    2.25 -import java.util.Collection;
    2.26 -
    2.27 -/**
    2.28 - *
    2.29 - * @author Ing. František Kučera (frantovo.cz)
    2.30 - */
    2.31 -public class CLIOptions {
    2.32 -
    2.33 -	/**
    2.34 -	 * Source directory
    2.35 -	 */
    2.36 -	private File input;
    2.37 -	/**
    2.38 -	 * Output directory
    2.39 -	 */
    2.40 -	private File output;
    2.41 -	/**
    2.42 -	 * Image resolutions to create
    2.43 -	 */
    2.44 -	private final Collection<SizeSpecification> sizes = new ArrayList<>();
    2.45 -
    2.46 -	public File getSourceDir() {
    2.47 -		return input;
    2.48 -	}
    2.49 -
    2.50 -	public void setInput(File input) {
    2.51 -		this.input = input;
    2.52 -	}
    2.53 -
    2.54 -	public File getDestinationDir() {
    2.55 -		return output;
    2.56 -	}
    2.57 -
    2.58 -	public void setOutput(File output) {
    2.59 -		this.output = output;
    2.60 -	}
    2.61 -
    2.62 -	public Collection<SizeSpecification> getSizes() {
    2.63 -		return sizes;
    2.64 -	}
    2.65 -
    2.66 -	public void addSize(SizeSpecification size) {
    2.67 -		sizes.add(size);
    2.68 -	}
    2.69 -
    2.70 -	public static class SizeSpecification {
    2.71 -
    2.72 -		private final int width;
    2.73 -		private final int height;
    2.74 -		private final String directory;
    2.75 -
    2.76 -		public SizeSpecification(int width, int height, String directory) {
    2.77 -			this.width = width;
    2.78 -			this.height = height;
    2.79 -			this.directory = directory;
    2.80 -		}
    2.81 -
    2.82 -		public int getWidth() {
    2.83 -			return width;
    2.84 -		}
    2.85 -
    2.86 -		public int getHeight() {
    2.87 -			return height;
    2.88 -		}
    2.89 -
    2.90 -		public String getDirectory() {
    2.91 -			return directory;
    2.92 -		}
    2.93 -	}
    2.94 -}
     3.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIParser.java	Sun Nov 16 21:57:03 2014 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,139 +0,0 @@
     3.4 -/**
     3.5 - * copy-image-resizer
     3.6 - * Copyright © 2014 František Kučera (frantovo.cz)
     3.7 - *
     3.8 - * This program is free software: you can redistribute it and/or modify
     3.9 - * it under the terms of the GNU General Public License as published by
    3.10 - * the Free Software Foundation, either version 3 of the License, or
    3.11 - * (at your option) any later version.
    3.12 - *
    3.13 - * This program is distributed in the hope that it will be useful,
    3.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    3.16 - * GNU General Public License for more details.
    3.17 - *
    3.18 - * You should have received a copy of the GNU General Public License
    3.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
    3.20 - */
    3.21 -package cz.frantovo.copyImageResizer;
    3.22 -
    3.23 -import java.io.File;
    3.24 -import java.util.Arrays;
    3.25 -import java.util.Collection;
    3.26 -
    3.27 -/**
    3.28 - *
    3.29 - * @author Ing. František Kučera (frantovo.cz)
    3.30 - */
    3.31 -public class CLIParser {
    3.32 -
    3.33 -	public CLIOptions parseOptions(String[] args) throws CLIParserException {
    3.34 -		CLIOptions options = new CLIOptions();
    3.35 -
    3.36 -		for (int i = 0; i < args.length; i++) {
    3.37 -			String arg = args[i];
    3.38 -
    3.39 -			boolean matches = false;
    3.40 -
    3.41 -			for (Token t : Token.values()) {
    3.42 -				if (t.matches(arg)) {
    3.43 -					int parsedArgs = t.parse(args, i, options);
    3.44 -					i = i + parsedArgs;
    3.45 -					matches = true;
    3.46 -				}
    3.47 -			}
    3.48 -
    3.49 -			if (!matches) {
    3.50 -				throw new CLIParserException("Unknown option: " + arg);
    3.51 -			}
    3.52 -		}
    3.53 -
    3.54 -		return options;
    3.55 -	}
    3.56 -
    3.57 -	private static String fetchNext(String[] args, int index) throws CLIParserException {
    3.58 -		if (index < args.length) {
    3.59 -			return args[index];
    3.60 -		} else {
    3.61 -			throw new CLIParserException("Expecting value for option: " + args[index - 1]);
    3.62 -		}
    3.63 -	}
    3.64 -
    3.65 -	private static enum Token {
    3.66 -
    3.67 -		INPUT_DIR("--input-dir") { // bash-completion: option
    3.68 -					@Override
    3.69 -					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    3.70 -						int originalIndex = index;
    3.71 -						String name = fetchNext(args, ++index);
    3.72 -						options.setInput(new File(name));
    3.73 -						return index - originalIndex;
    3.74 -					}
    3.75 -				},
    3.76 -		OUTPUT_DIR("--output-dir") { // bash-completion: option
    3.77 -					@Override
    3.78 -					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    3.79 -						int originalIndex = index;
    3.80 -						String name = fetchNext(args, ++index);
    3.81 -						options.setOutput(new File(name));
    3.82 -						return index - originalIndex;
    3.83 -					}
    3.84 -				},
    3.85 -		SIZE("--size") { // bash-completion: option
    3.86 -					@Override
    3.87 -					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    3.88 -						int originalIndex = index;
    3.89 -						int width = parseInt(fetchNext(args, ++index));
    3.90 -						int height = parseInt(fetchNext(args, ++index));
    3.91 -						String directory = width + "x" + height;
    3.92 -						options.addSize(new CLIOptions.SizeSpecification(width, height, directory));
    3.93 -						return index - originalIndex;
    3.94 -					}
    3.95 -				},
    3.96 -		SIZE_NAMED("--size-named") { // bash-completion: option
    3.97 -					@Override
    3.98 -					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    3.99 -						int originalIndex = index;
   3.100 -						int width = parseInt(fetchNext(args, ++index));
   3.101 -						int height = parseInt(fetchNext(args, ++index));
   3.102 -						String directory = fetchNext(args, ++index);
   3.103 -						options.addSize(new CLIOptions.SizeSpecification(width, height, directory));
   3.104 -						return index - originalIndex;
   3.105 -					}
   3.106 -				};
   3.107 -
   3.108 -		private final Collection<String> options;
   3.109 -
   3.110 -		private Token(String... options) {
   3.111 -			this.options = Arrays.asList(options);
   3.112 -		}
   3.113 -
   3.114 -		/**
   3.115 -		 * @param option e.g. „--input-file“
   3.116 -		 * @return whether option is this token
   3.117 -		 */
   3.118 -		public boolean matches(String option) {
   3.119 -			return options.contains(option);
   3.120 -		}
   3.121 -
   3.122 -		private static int parseInt(String number) throws CLIParserException {
   3.123 -			try {
   3.124 -				return Integer.parseInt(number);
   3.125 -			} catch (Exception e) {
   3.126 -				throw new CLIParserException("Unable to parse integer: " + number, e);
   3.127 -			}
   3.128 -		}
   3.129 -
   3.130 -		/**
   3.131 -		 * Parse String arguments and fill values into the options object.
   3.132 -		 *
   3.133 -		 * @param args CLI arguments
   3.134 -		 * @param index index of the option matched by this token, like „--input-file“
   3.135 -		 * @param options object to be filled
   3.136 -		 * @return number of parsed arguments – if option has no arguments (just boolean flag),
   3.137 -		 * return 0, otherwise return positive integer: number of eaten arguments.
   3.138 -		 * @throws CLIParserException
   3.139 -		 */
   3.140 -		public abstract int parse(String[] args, int index, CLIOptions options) throws CLIParserException;
   3.141 -	}
   3.142 -}
     4.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIParserException.java	Sun Nov 16 21:57:03 2014 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,41 +0,0 @@
     4.4 -/**
     4.5 - * copy-image-resizer
     4.6 - * Copyright © 2014 František Kučera (frantovo.cz)
     4.7 - *
     4.8 - * This program is free software: you can redistribute it and/or modify
     4.9 - * it under the terms of the GNU General Public License as published by
    4.10 - * the Free Software Foundation, either version 3 of the License, or
    4.11 - * (at your option) any later version.
    4.12 - *
    4.13 - * This program is distributed in the hope that it will be useful,
    4.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    4.16 - * GNU General Public License for more details.
    4.17 - *
    4.18 - * You should have received a copy of the GNU General Public License
    4.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
    4.20 - */
    4.21 -package cz.frantovo.copyImageResizer;
    4.22 -
    4.23 -/**
    4.24 - *
    4.25 - * @author Ing. František Kučera (frantovo.cz)
    4.26 - */
    4.27 -public class CLIParserException extends CopyImageResizerException {
    4.28 -
    4.29 -	public CLIParserException() {
    4.30 -	}
    4.31 -
    4.32 -	public CLIParserException(String message) {
    4.33 -		super(message);
    4.34 -	}
    4.35 -
    4.36 -	public CLIParserException(Throwable cause) {
    4.37 -		super(cause);
    4.38 -	}
    4.39 -
    4.40 -	public CLIParserException(String message, Throwable cause) {
    4.41 -		super(message, cause);
    4.42 -	}
    4.43 -
    4.44 -}
     5.1 --- a/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/CLIStarter.java	Sun Nov 16 21:57:03 2014 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,34 +0,0 @@
     5.4 -/**
     5.5 - * copy-image-resizer
     5.6 - * Copyright © 2014 František Kučera (frantovo.cz)
     5.7 - *
     5.8 - * This program is free software: you can redistribute it and/or modify
     5.9 - * it under the terms of the GNU General Public License as published by
    5.10 - * the Free Software Foundation, either version 3 of the License, or
    5.11 - * (at your option) any later version.
    5.12 - *
    5.13 - * This program is distributed in the hope that it will be useful,
    5.14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    5.15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    5.16 - * GNU General Public License for more details.
    5.17 - *
    5.18 - * You should have received a copy of the GNU General Public License
    5.19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.
    5.20 - */
    5.21 -package cz.frantovo.copyImageResizer;
    5.22 -
    5.23 -/**
    5.24 - *
    5.25 - * @author Ing. František Kučera (frantovo.cz)
    5.26 - */
    5.27 -public class CLIStarter {
    5.28 -
    5.29 -	/**
    5.30 -	 * @param args the command line arguments
    5.31 -	 */
    5.32 -	public static void main(String[] args) {
    5.33 -		// TODO code application logic here
    5.34 -		System.out.println("TODO");
    5.35 -	}
    5.36 -	
    5.37 -}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIOptions.java	Sun Nov 16 21:59:13 2014 +0100
     6.3 @@ -0,0 +1,91 @@
     6.4 +/**
     6.5 + * copy-image-resizer
     6.6 + * Copyright © 2014 František Kučera (frantovo.cz)
     6.7 + *
     6.8 + * This program is free software: you can redistribute it and/or modify
     6.9 + * it under the terms of the GNU General Public License as published by
    6.10 + * the Free Software Foundation, either version 3 of the License, or
    6.11 + * (at your option) any later version.
    6.12 + *
    6.13 + * This program is distributed in the hope that it will be useful,
    6.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    6.16 + * GNU General Public License for more details.
    6.17 + *
    6.18 + * You should have received a copy of the GNU General Public License
    6.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    6.20 + */
    6.21 +package cz.frantovo.copyImageResizer.cli;
    6.22 +
    6.23 +import java.io.File;
    6.24 +import java.util.ArrayList;
    6.25 +import java.util.Collection;
    6.26 +
    6.27 +/**
    6.28 + *
    6.29 + * @author Ing. František Kučera (frantovo.cz)
    6.30 + */
    6.31 +public class CLIOptions {
    6.32 +
    6.33 +	/**
    6.34 +	 * Source directory
    6.35 +	 */
    6.36 +	private File input;
    6.37 +	/**
    6.38 +	 * Output directory
    6.39 +	 */
    6.40 +	private File output;
    6.41 +	/**
    6.42 +	 * Image resolutions to create
    6.43 +	 */
    6.44 +	private final Collection<SizeSpecification> sizes = new ArrayList<>();
    6.45 +
    6.46 +	public File getSourceDir() {
    6.47 +		return input;
    6.48 +	}
    6.49 +
    6.50 +	public void setInput(File input) {
    6.51 +		this.input = input;
    6.52 +	}
    6.53 +
    6.54 +	public File getDestinationDir() {
    6.55 +		return output;
    6.56 +	}
    6.57 +
    6.58 +	public void setOutput(File output) {
    6.59 +		this.output = output;
    6.60 +	}
    6.61 +
    6.62 +	public Collection<SizeSpecification> getSizes() {
    6.63 +		return sizes;
    6.64 +	}
    6.65 +
    6.66 +	public void addSize(SizeSpecification size) {
    6.67 +		sizes.add(size);
    6.68 +	}
    6.69 +
    6.70 +	public static class SizeSpecification {
    6.71 +
    6.72 +		private final int width;
    6.73 +		private final int height;
    6.74 +		private final String directory;
    6.75 +
    6.76 +		public SizeSpecification(int width, int height, String directory) {
    6.77 +			this.width = width;
    6.78 +			this.height = height;
    6.79 +			this.directory = directory;
    6.80 +		}
    6.81 +
    6.82 +		public int getWidth() {
    6.83 +			return width;
    6.84 +		}
    6.85 +
    6.86 +		public int getHeight() {
    6.87 +			return height;
    6.88 +		}
    6.89 +
    6.90 +		public String getDirectory() {
    6.91 +			return directory;
    6.92 +		}
    6.93 +	}
    6.94 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIParser.java	Sun Nov 16 21:59:13 2014 +0100
     7.3 @@ -0,0 +1,139 @@
     7.4 +/**
     7.5 + * copy-image-resizer
     7.6 + * Copyright © 2014 František Kučera (frantovo.cz)
     7.7 + *
     7.8 + * This program is free software: you can redistribute it and/or modify
     7.9 + * it under the terms of the GNU General Public License as published by
    7.10 + * the Free Software Foundation, either version 3 of the License, or
    7.11 + * (at your option) any later version.
    7.12 + *
    7.13 + * This program is distributed in the hope that it will be useful,
    7.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    7.16 + * GNU General Public License for more details.
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License
    7.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    7.20 + */
    7.21 +package cz.frantovo.copyImageResizer.cli;
    7.22 +
    7.23 +import java.io.File;
    7.24 +import java.util.Arrays;
    7.25 +import java.util.Collection;
    7.26 +
    7.27 +/**
    7.28 + *
    7.29 + * @author Ing. František Kučera (frantovo.cz)
    7.30 + */
    7.31 +public class CLIParser {
    7.32 +
    7.33 +	public CLIOptions parseOptions(String[] args) throws CLIParserException {
    7.34 +		CLIOptions options = new CLIOptions();
    7.35 +
    7.36 +		for (int i = 0; i < args.length; i++) {
    7.37 +			String arg = args[i];
    7.38 +
    7.39 +			boolean matches = false;
    7.40 +
    7.41 +			for (Token t : Token.values()) {
    7.42 +				if (t.matches(arg)) {
    7.43 +					int parsedArgs = t.parse(args, i, options);
    7.44 +					i = i + parsedArgs;
    7.45 +					matches = true;
    7.46 +				}
    7.47 +			}
    7.48 +
    7.49 +			if (!matches) {
    7.50 +				throw new CLIParserException("Unknown option: " + arg);
    7.51 +			}
    7.52 +		}
    7.53 +
    7.54 +		return options;
    7.55 +	}
    7.56 +
    7.57 +	private static String fetchNext(String[] args, int index) throws CLIParserException {
    7.58 +		if (index < args.length) {
    7.59 +			return args[index];
    7.60 +		} else {
    7.61 +			throw new CLIParserException("Expecting value for option: " + args[index - 1]);
    7.62 +		}
    7.63 +	}
    7.64 +
    7.65 +	private static enum Token {
    7.66 +
    7.67 +		INPUT_DIR("--input-dir") { // bash-completion: option
    7.68 +					@Override
    7.69 +					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    7.70 +						int originalIndex = index;
    7.71 +						String name = fetchNext(args, ++index);
    7.72 +						options.setInput(new File(name));
    7.73 +						return index - originalIndex;
    7.74 +					}
    7.75 +				},
    7.76 +		OUTPUT_DIR("--output-dir") { // bash-completion: option
    7.77 +					@Override
    7.78 +					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    7.79 +						int originalIndex = index;
    7.80 +						String name = fetchNext(args, ++index);
    7.81 +						options.setOutput(new File(name));
    7.82 +						return index - originalIndex;
    7.83 +					}
    7.84 +				},
    7.85 +		SIZE("--size") { // bash-completion: option
    7.86 +					@Override
    7.87 +					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    7.88 +						int originalIndex = index;
    7.89 +						int width = parseInt(fetchNext(args, ++index));
    7.90 +						int height = parseInt(fetchNext(args, ++index));
    7.91 +						String directory = width + "x" + height;
    7.92 +						options.addSize(new CLIOptions.SizeSpecification(width, height, directory));
    7.93 +						return index - originalIndex;
    7.94 +					}
    7.95 +				},
    7.96 +		SIZE_NAMED("--size-named") { // bash-completion: option
    7.97 +					@Override
    7.98 +					public int parse(String[] args, int index, CLIOptions options) throws CLIParserException {
    7.99 +						int originalIndex = index;
   7.100 +						int width = parseInt(fetchNext(args, ++index));
   7.101 +						int height = parseInt(fetchNext(args, ++index));
   7.102 +						String directory = fetchNext(args, ++index);
   7.103 +						options.addSize(new CLIOptions.SizeSpecification(width, height, directory));
   7.104 +						return index - originalIndex;
   7.105 +					}
   7.106 +				};
   7.107 +
   7.108 +		private final Collection<String> options;
   7.109 +
   7.110 +		private Token(String... options) {
   7.111 +			this.options = Arrays.asList(options);
   7.112 +		}
   7.113 +
   7.114 +		/**
   7.115 +		 * @param option e.g. „--input-file“
   7.116 +		 * @return whether option is this token
   7.117 +		 */
   7.118 +		public boolean matches(String option) {
   7.119 +			return options.contains(option);
   7.120 +		}
   7.121 +
   7.122 +		private static int parseInt(String number) throws CLIParserException {
   7.123 +			try {
   7.124 +				return Integer.parseInt(number);
   7.125 +			} catch (Exception e) {
   7.126 +				throw new CLIParserException("Unable to parse integer: " + number, e);
   7.127 +			}
   7.128 +		}
   7.129 +
   7.130 +		/**
   7.131 +		 * Parse String arguments and fill values into the options object.
   7.132 +		 *
   7.133 +		 * @param args CLI arguments
   7.134 +		 * @param index index of the option matched by this token, like „--input-file“
   7.135 +		 * @param options object to be filled
   7.136 +		 * @return number of parsed arguments – if option has no arguments (just boolean flag),
   7.137 +		 * return 0, otherwise return positive integer: number of eaten arguments.
   7.138 +		 * @throws CLIParserException
   7.139 +		 */
   7.140 +		public abstract int parse(String[] args, int index, CLIOptions options) throws CLIParserException;
   7.141 +	}
   7.142 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIParserException.java	Sun Nov 16 21:59:13 2014 +0100
     8.3 @@ -0,0 +1,43 @@
     8.4 +/**
     8.5 + * copy-image-resizer
     8.6 + * Copyright © 2014 František Kučera (frantovo.cz)
     8.7 + *
     8.8 + * This program is free software: you can redistribute it and/or modify
     8.9 + * it under the terms of the GNU General Public License as published by
    8.10 + * the Free Software Foundation, either version 3 of the License, or
    8.11 + * (at your option) any later version.
    8.12 + *
    8.13 + * This program is distributed in the hope that it will be useful,
    8.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    8.16 + * GNU General Public License for more details.
    8.17 + *
    8.18 + * You should have received a copy of the GNU General Public License
    8.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    8.20 + */
    8.21 +package cz.frantovo.copyImageResizer.cli;
    8.22 +
    8.23 +import cz.frantovo.copyImageResizer.CopyImageResizerException;
    8.24 +
    8.25 +/**
    8.26 + *
    8.27 + * @author Ing. František Kučera (frantovo.cz)
    8.28 + */
    8.29 +public class CLIParserException extends CopyImageResizerException {
    8.30 +
    8.31 +	public CLIParserException() {
    8.32 +	}
    8.33 +
    8.34 +	public CLIParserException(String message) {
    8.35 +		super(message);
    8.36 +	}
    8.37 +
    8.38 +	public CLIParserException(Throwable cause) {
    8.39 +		super(cause);
    8.40 +	}
    8.41 +
    8.42 +	public CLIParserException(String message, Throwable cause) {
    8.43 +		super(message, cause);
    8.44 +	}
    8.45 +
    8.46 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/java/copy-image-resizer/src/cz/frantovo/copyImageResizer/cli/CLIStarter.java	Sun Nov 16 21:59:13 2014 +0100
     9.3 @@ -0,0 +1,34 @@
     9.4 +/**
     9.5 + * copy-image-resizer
     9.6 + * Copyright © 2014 František Kučera (frantovo.cz)
     9.7 + *
     9.8 + * This program is free software: you can redistribute it and/or modify
     9.9 + * it under the terms of the GNU General Public License as published by
    9.10 + * the Free Software Foundation, either version 3 of the License, or
    9.11 + * (at your option) any later version.
    9.12 + *
    9.13 + * This program is distributed in the hope that it will be useful,
    9.14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    9.16 + * GNU General Public License for more details.
    9.17 + *
    9.18 + * You should have received a copy of the GNU General Public License
    9.19 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
    9.20 + */
    9.21 +package cz.frantovo.copyImageResizer.cli;
    9.22 +
    9.23 +/**
    9.24 + *
    9.25 + * @author Ing. František Kučera (frantovo.cz)
    9.26 + */
    9.27 +public class CLIStarter {
    9.28 +
    9.29 +	/**
    9.30 +	 * @param args the command line arguments
    9.31 +	 */
    9.32 +	public static void main(String[] args) {
    9.33 +		// TODO code application logic here
    9.34 +		System.out.println("TODO");
    9.35 +	}
    9.36 +	
    9.37 +}