1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package net.sourceforge.plantumldependency.commoncli.constants;
26
27 import static java.util.Arrays.asList;
28 import static java.util.Collections.unmodifiableSet;
29
30 import java.util.List;
31 import java.util.Set;
32 import java.util.TreeSet;
33
34 import net.sourceforge.plantumldependency.commoncli.option.status.OptionStatus;
35
36
37
38
39
40
41
42
43 public final class CommandLineConstants {
44
45
46 public static final String EXAMPLES_OPTIONS_CMD = "Examples:";
47
48
49 public static final Set < String > IMPORTANT_SYSTEM_PROPERTIES = unmodifiableSet(new TreeSet < String >(
50 asList(new String[] {"java.runtime.name", "java.version", "java.vm.name", "os.name", "os.arch",
51 "os.version"})));
52
53
54 public static final String JAVA_JAR_CMD = "java -jar ";
55
56
57 public static final String KNOWN_BUGS_OR_LIMITATIONS_CMD = "Known bugs or program limitations:";
58
59
60 public static final String MANDATORY_OPTIONS_CMD = "where mandatory options are:";
61
62
63 public static final Set < OptionStatus > OPTION_STATUS_ACTIVE_SET = createOptionStatusActiveSet(asList(OptionStatus
64 .values()));
65
66
67 public static final Set < OptionStatus > OPTION_STATUS_MANDATORY_SET = createOptionStatusMandatorySet(asList(OptionStatus
68 .values()));
69
70
71 public static final Set < OptionStatus > OPTION_STATUS_SET = unmodifiableSet(new TreeSet < OptionStatus >(
72 asList(OptionStatus.values())));
73
74
75 public static final String OPTIONAL_OPTIONS_CMD = "where optional options are:";
76
77
78 public static final String OPTIONS_CMD = "[OPTIONS]";
79
80
81 public static final String PROTECTED_DOT_REGEXP = "\\.";
82
83
84 public static final String USAGE_CMD = "Usage:";
85
86
87
88
89
90
91
92
93
94
95 private static Set < OptionStatus > createOptionStatusActiveSet(final List < OptionStatus > optionStatusList) {
96 final Set < OptionStatus > optionStatusActiveSet = new TreeSet < OptionStatus >();
97
98 for (final OptionStatus optionStatus : optionStatusList) {
99 if (optionStatus.isActive()) {
100 optionStatusActiveSet.add(optionStatus);
101 }
102 }
103
104 return unmodifiableSet(optionStatusActiveSet);
105 }
106
107
108
109
110
111
112
113
114
115 private static Set < OptionStatus > createOptionStatusMandatorySet(final List < OptionStatus > optionStatusList) {
116 final Set < OptionStatus > optionStatuMandatorySet = new TreeSet < OptionStatus >();
117
118 for (final OptionStatus optionStatus : optionStatusList) {
119 if (optionStatus.isMandatory()) {
120 optionStatuMandatorySet.add(optionStatus);
121 }
122 }
123
124 return unmodifiableSet(optionStatuMandatorySet);
125 }
126
127
128
129
130
131
132 private CommandLineConstants() {
133 super();
134 }
135 }