1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dishevelled.iconbundle.tools;
25
26 import java.io.File;
27
28 import org.dishevelled.commandline.Usage;
29 import org.dishevelled.commandline.Switch;
30 import org.dishevelled.commandline.Argument;
31 import org.dishevelled.commandline.ArgumentList;
32 import org.dishevelled.commandline.CommandLine;
33 import org.dishevelled.commandline.CommandLineParser;
34 import org.dishevelled.commandline.CommandLineParseException;
35
36 import org.dishevelled.commandline.argument.FileArgument;
37 import org.dishevelled.commandline.argument.StringArgument;
38
39 import org.dishevelled.iconbundle.IconBundle;
40
41 import org.dishevelled.iconbundle.impl.PNGIconBundle;
42
43
44
45
46
47
48 public final class PNGVariants
49 {
50
51
52
53
54
55
56 public static final void main(final String[] args)
57 {
58 CommandLine commandLine = null;
59 ArgumentList arguments = null;
60 try
61 {
62 commandLine = new CommandLine(args);
63
64 Argument<File> i = new FileArgument("i", "input", "input file", true);
65 Argument<String> o = new StringArgument("o", "output", "output file name", true);
66 Argument<Boolean> b = new Switch("b", "draw-borders", "true to draw borders");
67
68 arguments = new ArgumentList(new Argument[] { i, o, b });
69
70 CommandLineParser.parse(commandLine, arguments);
71
72 IconBundle iconBundle = new PNGIconBundle(i.getValue());
73
74 Runnable sav = new ShowAllVariants(iconBundle, o.getValue(), b.getValue());
75 sav.run();
76 }
77 catch (CommandLineParseException e)
78 {
79 Usage.usage("java -jar png-variants.jar [args]\n\nPNG Variants", e, commandLine, arguments, System.err);
80 }
81 catch (IllegalArgumentException e)
82 {
83 Usage.usage("java -jar png-variants.jar [args]\n\nPNG Variants", e, commandLine, arguments, System.err);
84 }
85 }
86 }