01: package jimm.datavision;
02:
03: import jimm.util.Getopts;
04:
05: /**
06: * This class is a holder of version and copyright information.
07: *
08: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
09: */
10: public class info {
11:
12: public static final int VERSION_MAJOR = 1;
13: public static final int VERSION_MINOR = 1;
14: public static final int VERSION_TWEAK = 0;
15:
16: public static final String Version = "" + VERSION_MAJOR + "."
17: + VERSION_MINOR + "." + VERSION_TWEAK;
18: public static final String Copyright = "Copyright (c) 2001-2007 Jim Menard, jimm@io.com";
19: public static final String URL = "http://datavision.sourceforge.net";
20:
21: /**
22: * usage: info [-v] [-c] [-u] [-n]
23: *
24: * Prints version (-v), copyright (-c), and/or URL (-u). If -n is specified,
25: * each is terminated with a newline. If it is not, no newline is output but
26: * they are separated by spaces if more than one of -v, -c, or -u was also
27: * specified.
28: */
29: public static void main(String[] args) {
30: Getopts g = new Getopts("vcun", args);
31: boolean moreThanOne = ((g.hasOption('v') ? 1 : 0)
32: + (g.hasOption('c') ? 1 : 0) + (g.hasOption('u') ? 1
33: : 0)) > 1;
34: String separator = g.hasOption('n') ? "\n" : " ";
35:
36: if (g.hasOption('v'))
37: System.out.print(Version);
38: if (moreThanOne)
39: System.out.print(separator);
40: if (g.hasOption('c'))
41: System.out.print(Copyright);
42: if (moreThanOne)
43: System.out.print(separator);
44: if (g.hasOption('u'))
45: System.out.print(URL);
46:
47: if (g.hasOption('n'))
48: System.out.println();
49: }
50:
51: }
|